Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2011
    Posts
    30
    Rep Power
    0

    Default Javamail Message Content as Text

    Hi, I have a program in which I want to parse a certain email. I already have the email that I want and the program finds its message number. Now what I want to do is get the text content of the message as a string so that I can begin to parse it. I have the content type returning as "multipart" Is there a way to convert this to a string? Any ideas?

  2. #2
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default

    Could you provide some example code? Could you describe the context of the question? Is this email just a large block of text in a text file and if so, have you looked at Regex in java?

  3. #3
    Join Date
    Jan 2011
    Posts
    30
    Rep Power
    0

    Default

    I figured it out I used the code:

    Multipart multipart = (Multipart) m.getContent();
    //get content as string
    BodyPart bodyPart = multipart.getBodyPart(0);
    content = (bodyPart.getContent().toString());

Similar Threads

  1. Replies: 0
    Last Post: 12-09-2010, 06:56 PM
  2. Javamail html mail sended as text
    By johniem in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2010, 11:17 PM
  3. Replies: 6
    Last Post: 06-04-2010, 09:43 PM
  4. Content Changing to many Text files
    By everythingteen in forum New To Java
    Replies: 3
    Last Post: 04-28-2010, 05:16 PM
  5. Replies: 0
    Last Post: 05-26-2008, 05:26 PM

Posting Permissions

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