Fellow Monks, My objective is to read newly incoming emails, parse them by to,from,subject,body
and store them in a dbase. I've installed a local copy of Mail::Audit to my
home dir but it seems to have problems reading MIME emails.

If I send an email to my account via my linux /bin/mail, all is OK.
However, if I use my Thunderbird,www.yahoo.com, to send emails
then I get only the body...headers are cut off.

Here's my .forward:
|/home/rob/bin/forward_email

Here's my forward_email:
#!/usr/bin/perl BEGIN{ unshift @INC, '/home/rob/lib/perl5/site_perl/5.8.3'; unshift @INC, '/home/rob/lib/perl5/5.8.3' } $\ = "\n"; select(STDERR); $| = 1; select(STDOUT); $| = 1; use warnings; use Mail::Audit; $mail = Mail::Audit->new(emergency=>"/home/rob/emergency_mbox",log= +>"/home/rob/audit.log",loglevel=>4); $from = $mail->from; $to = $mail->to; $subject = $mail->subject; @body = @{$mail->body}; #chomp($from, $to, $subject); open(FILE, ">> /home/rob/mynewmail.log"); print FILE "from is $from"; print FILE "to is $to"; print FILE "subj is $subject"; print FILE "body is @body"; close(FILE);
All it prints in mynewmail.log is:
from is to is subj is body is &lt the body is here &gt
But interestingly, it prints the true headers in the audit.log
file regardless if it's a MIME message or not. --what do you guys think? --

In reply to parsing email by Mail::Audit by rhxk

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.