Results 1 to 1 of 1
  1. #1
    lowell108 is offline Member
    Join Date
    Dec 2009
    Posts
    3
    Rep Power
    0

    Default 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
    1. Mixed
    2. Alternative
    3. Related

    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.
    Last edited by lowell108; 01-04-2010 at 03:40 PM.

Similar Threads

  1. a problem about java mail client program
    By lunarstyle in forum AWT / Swing
    Replies: 9
    Last Post: 12-19-2009, 05:14 PM
  2. problem with sending mail usin javaX.mail api
    By sandeepsai39 in forum New To Java
    Replies: 4
    Last Post: 11-25-2009, 06:37 AM
  3. Problem in sending mail from java
    By npoorni in forum Advanced Java
    Replies: 1
    Last Post: 06-30-2009, 05:09 PM
  4. Java mail problem Urgent
    By sundarjothi in forum Advanced Java
    Replies: 0
    Last Post: 06-02-2008, 12:34 PM
  5. Replies: 2
    Last Post: 05-05-2008, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •