Welcome to Srini's blog

Wednesday, June 2, 2010

Mail issue in Java

Yesterday I got an issue with sending mails in java. If the mail contains any japanese chars it displaying Q.M(?). We know If we provide encoding as UTF-8 prob will solve, but eventhough we provided encoding the issue is not resolved, While debugging I got a clue that the content still usnig another encoding, Finally A quick googling its resolved.

The problomatice code line is
MimeMessageHelper helper = new MimeMessageHelper(message, true);

Corrected code line is
MimeMessageHelper helper = new MimeMessageHelper(message, true, "UTF-8");

No comments:

Post a Comment