wise Monks,
After some month away from the monastery, I'm back with a maybe interesting question.

I'm developping a little application, one component of wich needs to download some mail messages from a POP3 account and do something with them according to data such as the From: address, the Subject header and (obviously) the contents.

I got this idea to use Mail::POP3Client for doing the download, and it works fine. But now I do not want to reinvent the wheel just another time, so I though to use the Mail::Message class to do the parsing for me.

Well, I'm unable to find a clean way to transform the string obtained by the HeadAndbody method of the Mail::POP3Client into a Mail::Message object (actually a subclass of it I defined).

So here comes the question. Am I too a blockhead to find how to do that, or realy this operation is so difficult?

Subsidiary question is: is there another way to parse a string conatining a mail message into some kind of structure allowing easy access to the different parts of the message?

Thank you and may your regex only match when they have to.


Leo TheHobbit

In reply to Reading Mail::Message objects using Mail::POP3Client by TheHobbit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.