I am doing simple formatting for an email with StringBuilder and have code that looks like the following.
StringBuilder message = new StringBuilder();
message.append("Name: " + model.getName() + "\r\n");
message.append("Organization: " + model.getOrganization() +"\r\n");
message.append("Comment: " + model.getComment() +"\r\n");
contactMessage.setMessage(message.toString());
I am logging the formatting and it works correctly, but it is coming out as one line when we actually check the emails being sent.
What if I am not using HTML though is my real question…thanks for the help.
What is the format of your email? If the format is HTML newline characters will be ignored and you’d need to insert HTML breaks
<br />.