You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/08/31 22:51:26 UTC
DO NOT REPLY [Bug 30973] New: -
[email] [patch] HTML email with plain text alternative and attachments
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30973>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30973
[email] [patch] HTML email with plain text alternative and attachments
Summary: [email] [patch] HTML email with plain text alternative
and attachments
Product: Commons
Version: Nightly Builds
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Sandbox
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: scott@minutestopost.com
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()
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org