Hi Fellow monks,

I'm wondering what's the best way or what's the best module to parse an email and get the decoded data in pure perl strings.

For instance, I'd love to parse something like that:

+ + + Received: by 10.115.106.19 with HTTP; Thu, 24 Jan 2008 09:10:50 -0800 +(PST) Message-ID: <f516fcd80801240910j797b0e09h26cbafede672403f@mail.gmail.c +om> Date: Thu, 24 Jan 2008 17:10:50 +0000 From: "=?UTF-8?Q?J=C3=A9r=C3=B4me_Et=C3=A9v=C3=A9?=" <jerome@eteve.net +> Sender: jerome.eteve@gmail.com To: "Jerome Eteve" <jerome@careerjet.com> Subject: =?UTF-8?B?2LbYsdix2Ykg2LfZiNmC2YjZhtmF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline Delivered-To: jerome.eteve@gmail.com X-Google-Sender-Auth: b14660e8948ad477 2LbYsdix2Ykg2LfZiNmC2YjZhtmFamlkamkgagoKZGppd29qZCB3b3dvd29vd293CgotLS +AKSmVy b21lIEV0ZXZlLgoKU3BlYWsgdG8gbWUgbGl2ZSBhdCBodHRwOi8vd3d3LmV0ZXZlLm5ldA +oKamVy b21lQGV0ZXZlLm5ldAo=

And then be able to do:

my $mail = MagicMailModule->parse($data) ; my $to = $mail->To() ; my $from = $mail->From() ; my $body = $mail->Body() ;

Do you have an idea of what I could use ?

Thanks for any help !!

-- Nice photos of naked perl sources here !


In reply to Parsing email by jeteve

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.