O'Reilly logo

Java™ Phrasebook by Timothy Fisher

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sending MIME Email

String html =
											"<html><head><title>Java Mail</title></head>" +
											"<body>Some HTML content.</body></html>";
											Multipart mp = new MimeMultipart();
											BodyPart textPart = new MimeBodyPart( );
											textPart.setText("This is the message body.");
											BodyPart htmlPart = new MimeBodyPart( );
											htmlPart.setContent(html, "text/html");
											mp.addBodyPart(textPart);
											mp.addBodyPart(htmlPart);
											msg.setContent(mp);
											Transport.send(msg);

MIME stands for Multimedia Internet Mail Extensions. MIME is supported by all major email clients and is the standard way of including attachments to messages. MIME allows you to attach a variety of media types, such as images, video, and .pdf files to an email message. The JavaMail API also supports MIME messages, and it is nearly ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required