I am trying to send an email in Java. What I am doing now is described in the following:
my_result = my_function();
// header
String notificationSubject = "Test email";
// content
final MimeMultipart notificationContent = new MimeMultipart();
BodyPart messageBodyPart = new MimeBodyPart();
messageBodyPart.setText("Plain text.");
notificationContent.addBodyPart(messageBodyPart);
... code to send the email ...
At the moment, the body of the email should be composed only by the text: "Plain text". I would like to write a more complex email like the following one:
Dear all,
the result of the operation was not successful. The following value caused a problem:Value: my_result
Best regards.
Where my_result
is the content of the corresponding variable.
How can I achieve the email I want managing the returns, the blank lines and the variable?