This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi all, I'm using javamail to send email notification which contains chinese or japanese characters. Subject line correctly displays chinese characters, however, the email content is garbled. How will i be able to encode the characters in utf-8? I've tried using MimeBodyPart methods such as setContent and setText, but still doesn't work.
Appreciate your help on this.
Joined: Aug 20, 2007
Below is the code:
setMimePart method does this:
Result of email content is like this: �������������������� ������������
message.setFrom( new InternetAddress( from ) );
message.addRecipient( Message.RecipientType.TO, new InternetAddress( toStringAddress ) );
message.addRecipient( Message.RecipientType.BCC, new InternetAddress( bccStringAddress ) );
// Setting the Subject and Content Type
message.setSubject( subject, "utf-8" ); // <----
// Create a message part to represent the body text
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setContent( messageContent, "text/html; charset=utf-8" ); // <----