Perl to process "mbox" file


S

Shankar

Hello,

Can someone please point me to a way to accomplish the following task.

I have made a copy of my "mbox" file in my AIX account, for processing
as follows.
I w'd like to automate:

1. Run through the mbox copy, and for each mail, using some logic on
fields like From, Date/Time, Subject, decide whether or not it is a
mail of interest.
2. If it is a mail of interest, examine whether or not it has
attachments. Then, save the attachments to a directory.
The attachments w'd be of type: *.txt, *.ps, *.pdf, *.doc

I have used PERL in the distant past for scripting on Unix, so thought
of going back to PERL.
I was hoping the PERL gurus w'd point me to a way to accomplish the
above, which I w'd have to do manually otherwise. The number of mails
in the mbox is quite large, so wish to automate.

Thanks a lot for your help,
Shankar
 
Ad

Advertisements

J

Jochen Lehmeier

Can someone please point me to a way to accomplish the following task.

http://search.cpan.org/~dcoppit/Mail-Mbox-MessageParser-1.5002/lib/Mail/Mbox/MessageParser/Perl.pm

or

http://search.cpan.org/~vparseval/Mail-MboxParser-0.55/

(I don't know either, they just turned up on google "perl mbox" and their
description seems to fit).
2. If it is a mail of interest, examine whether or not it has
attachments. Then, save the attachments to a directory.

Mail::MboxParser::Mail has methods to get the attachments and headers.
I was hoping the PERL gurus w'd point me to a way to accomplish the
above, which I w'd have to do manually otherwise. The number of mails
in the mbox is quite large, so wish to automate.

The example code given in the above pages should get you started. Feel
free to post more specific questions (together with your code so far, and
a short mbox file for testing).
 
S

Steve C

Shankar said:
Hello,

Can someone please point me to a way to accomplish the following task.

I have made a copy of my "mbox" file in my AIX account, for processing
as follows.
I w'd like to automate:

1. Run through the mbox copy, and for each mail, using some logic on
fields like From, Date/Time, Subject, decide whether or not it is a
mail of interest.
2. If it is a mail of interest, examine whether or not it has
attachments. Then, save the attachments to a directory.
The attachments w'd be of type: *.txt, *.ps, *.pdf, *.doc

I have used PERL in the distant past for scripting on Unix, so thought
of going back to PERL.
I was hoping the PERL gurus w'd point me to a way to accomplish the
above, which I w'd have to do manually otherwise. The number of mails
in the mbox is quite large, so wish to automate.

There are many CPAN modules dedicated to handling and parsing mail,
so you won't need to start from scratch.

I see Mail::MboxParser which claims to properly handle attachments
of mail in an MBox file, but you should look through some of the
others.
 
K

Kevin Collins

On 2009-12-28 said:
I w'd like to automate:
^^^

Is that supposed to be "would"? There is no contraction for that word, and this
is not a chat room, so please spell it out.

Thanks,

Kevin
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top