我已經使用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());}
添加回答
舉報
0/150
提交
取消