How can I set the transfer encoding type??? I wish to send an HTML mail using MimeMessage class and encode it to "base64". but I couldn't set the Content-Transfer-Encoding value of mail header.

marx0207 wang

Encode the Html in "Base64", for example:

String Html="<html><body>"+
            "this is a test"+  
MimeMessage msg =new MimeMessage();
String DefaultCharSet=
Q short for Quoted Printable
B short for Base64


I use MimeUtility.encodeText(,,) for encode process, you could use that method encode your HTML string in "B"--Base64 and be set on the message part.

for details check in JavaMail Api javax.mail.internet.Mimeutility section.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact