Reputation: 6920
How to create a MimeMessage object using String in java
MimeMultipart multiPart = new MimeMultipart();
and need to set content from a String Object
Upvotes: 2
Views: 2195
Reputation: 23415
This code will do this:
MimeBodyPart messagePart = new MimeBodyPart();
MimeMultipart multipart = new MimeMultipart();
messagePart.setText("You message's string content goes here.", "utf-8");
multipart.addBodyPart(messagePart);
You have to create a MimeBodyPart
object, then set all needed properties to it and add it to MimeMultipart
.
Upvotes: 3