Setting the from name in a javax.mail.MimeMessage?

OK, reading documentation about ALL the classes involved would have been helpful. The correct syntax should be

Message msg = new MimeMessage(mailSession);
msg.setFrom(new InternetAddress("mail@companyxyz.com", "Company XYZ"));

Source: https://javamail.java.net/nonav/docs/api/javax/mail/internet/InternetAddress.html

Leave a Comment

tech