How can I send a mail message with multiple lines in the body?

Ivo Limmen

You need to manually add the new lines to the message. Try the following:

StringBuffer sb = new StringBuffer();

sb.append("This is line 1

sb.append("This is the second line


You must use one bodypart with text but the text can contain multiple lines. So you need to use the .

You can also use
String newline = System.getProperty("line.separator");
to get the platform-specific line separator. Keep in mind that if you display the text as HTML, the newline is just white space.