commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott <>
Subject Re: [email] html email with attachments - update
Date Fri, 20 Aug 2004 22:48:56 GMT

Martin Cooper wrote:
> On Fri, 20 Aug 2004 16:04:12 -0400, Scott <> wrote:
>>Attached is an updated (somewhat quick-and-dirty) patch for
>> (the previous one had problems :)). It allows you do
>>to something like:
>>MultiPartEmail email = new MultiPartEmail();
>>email.setSubject("message subject");
>>MimeMultipart multiPart = new MimeMultipart("alternative");
>>// text alternative
>>MimeBodyPart bodyPart1 = new MimeBodyPart();
>>bodyPart1.setContent("Text message", "text/plain");
>>// html alternative
>>MimeBodyPart bodyPart2 = new MimeBodyPart();
>>bodyPart2.setContent("<html><body><p>html message</p></body></html>",
>>// add attachments if you'd like, then
> No doubt I'm missing something obvious here, but why would you want to
> construct a message like the one above? Unless I'm mistaken, what the
> above code creates is a message structured like:
>     multipart/mixed
>         multipart/alternate
>             text/plain
>             text/html
> Now I understand the alternate with text and HTML, by why are you
> wrapping this in another multipart (which only has one part!) of type
> mixed?

Yes, the above example doesn't make sense unless you're adding 
attachments. What I'd like is:

The current MultiPartEmail doesn't allow you to do this, and the 
HtmlEmail class won't do the job either (plain text alternatives do not 
work properly with HtmlEmail). To be honest, I'd prefer to rewrite 
larger parts of both classes (wouldn't actually be a lot of work to get 
everything sorted out, I don't think) than use the patch, but thought 
I'd start somewhere :).


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message