Tag Archives: Mail

Review: Entourage 2008 vs Apple Mail

I used Entourage 2004 on my MacBook for about a year and then, in January, I upgraded to Entourage 2008. There were a couple of things I found frustrating about Entourage (especially compared with Outlook 2000 on the PC) such as the inability to easily put tables into HTML emails. But I persevered until last week when I finally upgraded to Mac OS 10.5 Leopard. The following article is a review of the pluses and minuses for Entourage 2008 versus the free Apple Mail 3.3 that comes with Leopard. Continue reading Review: Entourage 2008 vs Apple Mail

UTF-8 subjects in javax.mail

I’ve been having problems with putting unicode strings into the subject of emails sent using javax.mail.

In the end, the solution was very simple and I found it here:

http://www.velocityreviews.com/forums/t132009-utf8-characters-not-appearing-correctly-in-email-subject-line.html

As long as you use “UTF-8” and not “UTF8” it all seems to work fine, so the code you need is:

Properties props = new Properties();
// put in your SMTP host in here
props.put("mail.smtp.host", "localhost");
Session s = Session.getInstance(props, null);

MimeMessage message = new MimeMessage(s);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject, "UTF-8");
message.setText(body, "UTF-8");
message.setHeader("Content-Type", "text/plain; charset=UTF-8");
Transport.send(message);