http://www.perlmonks.org?node_id=1014758

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hiya Monks...,

I need to get the 'subject:' using the MIME::Parser. How can I get that...?

We will get the body by using $data->{BODY}

Can I do it like this,   $data->{HEADER}; ? to get the subject, If not pls guide me through.

Thx in advance

Replies are listed 'Best First'.
Re: how to get "Subject" using MIME::Parser ?
by moritz (Cardinal) on Jan 22, 2013 at 18:59 UTC
Re: how to get "Subject" using MIME::Parser ?
by runrig (Abbot) on Jan 22, 2013 at 20:04 UTC
    We will get the body by using $data->{BODY}
    I do not think that will work.

    MIME::Parser's parse methods return a MIME::Entity object. You'd be better off reading the documentation for those libraries and using the documented methods to get the body and the other parts of the email that you require.

Re: how to get "Subject" using MIME::Parser ?
by mhearse (Chaplain) on Jan 22, 2013 at 20:35 UTC
    Years ago I was archiving terabytes of email to a compressed mysql db. Since there is a great deal of duplication when dealing with email, this seemed like a good solution at the time. I became frustrated with MIME::Parser for several reasons, including the one mentioned in your post. This is probably because of my limited knowledge of perl.

    I'm ashamed to say that I ended up using python. And found email parsing a bit less cryptic.

Re: how to get "Subject" using MIME::Parser ?
by Anonymous Monk on Jan 22, 2013 at 23:46 UTC