我已经使用JMS在Web应用程序中成功发送了电子邮件,但是结果仅以纯文本显示。我希望内容能够显示html。我该怎么做?这大致就是我所拥有的:
Message msg = new MimeMessage(mailSession);
try{
msg.setSubject("Test Notification");
msg.setRecipient(Message.RecipientType.TO, new InternetAddress(sentTo, false));
String message = "<div style=\"color:red;\">BRIDGEYE</div>";
msg.setContent(message, "text/html; charset=utf-8");
msg.setSentDate(new Date());
Transport.send(msg);
}catch(MessagingException me){
logger.log(Level.SEVERE, "sendEmailNotification: {0}", me.getMessage());
}
猛跑小猪
POPMUISE
相关分类