Java Mail Multipart Problem
I've been knocking my head against this problem for a while -- help would be appreciated.
I'm sending a multipart message with an attachment.
I create a MimeMessage, set the "from", set the "to".
I Create a MimeMultipart. I try setting the this to
I create a text only bodypart and add it to the Multipart.
I create an html bodypart and add it to the multipart.
I read in an image, give it a symbolic name and add it to the multipart.
I create a bodypart and add an attachment to it and add it to the multipart.
Here's what happens:
When I set the multipart subtype to mixed, it reads in the image correctly and attaches the file, but BOTH the html and the plain text message show up in Yahoo and Gmail (which both seem to be set to always allow html ) In Outlook where I have set it up to be plain text only, it behaves correctly (except that the html is attached, but that doesn't bother me.)
When I set the multipart subtype to related, the behavior is the same.
When I set the multipart subtype to alternative, it sends the html and the plain text versions correctly, but doesn't send the attachment.
Is there a way to do everything I want to do?? I think there must be a solution to this.
Thanks in advance for your help.