dcsimg

How do I send an HTML content message through the JavaMail API?

John Zukowski

First create a String object containg the HTML text for the message. Then use setContent() to set the message content to a specific content-type. For example :

String msgText = getHtmlMessageText(...);
msg.setContent(msgText, "text/html");