in reply to Mail::Box::Mbox adds a strange boundary when read email

The string is a MIME boundary marker. It is used to seperate the different parts of the message. e.g. a message with an attachment might have a multipart/alternative part, containing a text/plain part and a text/html part, followed by an application/octet-stream part. This nested email structure is kept straight by the use of these boundaries.

You've called ->string on the object, asking for the message as a single string - which is what you've got.

If you want just some parts of the message, look at some of the other methods in Mail::Box::Message - there is a full selection of methods to pick apart the message, e.g. ->parts pulls apart the message into its constituent body parts.

Read the docs, have a play with these modules and don't forget to test with emails of different types (with and without attachments, with and without HTML alternatives, etc).

  • Comment on Re: Mail::Box::Mbox adds a strange boundary when read email

Replies are listed 'Best First'.
Re^2: Mail::Box::Mbox adds a strange boundary when read email
by dlegia (Initiate) on Dec 19, 2006 at 14:13 UTC
    Yes, you are right, I can use a lot of methods to handle different parts of email message, but in this case I want to get the source of the email.
    My final target is to have all the email separated in an Array and to save them in different files
    If this strange boundary is a part of my target file when I try to open the file from Outlook Express the Email application is adding a non existing Email Attachment.
    In example above the Outlook Express will open an Email with attachment: ATT00002.txt which is wrong the part is just a html body not the attachment.
    I hope you can undestand me.
      I think Outlook is correct. The top-level content type (in the headers) is multipart.

      If you want a plain HTML mail (and you should really send multipart/mixed(text/plain + text/html)) then you should create it that way to start with. The headers suggest that you're creating the mail programatically. If you don't like the way it has been created then my advice would be to take a look at that and do it differently...