Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
Nightly Builds
-
None
-
None
-
Operating System: other
Platform: Other
-
30973
Description
With the current MultiPartEmail class, you currently cannot properly create a
message that contains an html part, a text alternative, and attachments. The
current HtmlEmail will not properly create such a message either. The attached
patch to MultiPartEmail allows you to do this, e.g.:
MultiPartEmail email = new MultiPartEmail();
email.setFrom("me@mydomain.com");
email.addTo("you@yourdomain.com");
email.setSubject("message subject");
email.setSubType("mixed");
MimeMultipart multiPart = new MimeMultipart("alternative");
// text alternative
MimeBodyPart bodyPart1 = new MimeBodyPart();
bodyPart1.setContent("Text message", "text/plain");
multiPart.addBodyPart(bodyPart1);
// html alternative
MimeBodyPart bodyPart2 = new MimeBodyPart();
bodyPart2.setContent("<html><body><p>html message</p></body></html>", "text/html");
multiPart.addBodyPart(bodyPart2);
email.addPart(multiPart);
// add attachments
email.send()