simple script to read and output Mailbox body to file.

William Park opengeometry at yahoo.ca
Tue Jun 8 06:59:15 EDT 2004


chuck amadi <chuck.amadi at ntlworld.com> wrote:
> William Park wrote:
> >You still haven't answered central questions.  
> >    - Do you want email bodies in separate files, or all email bodies in
> >      one file?
> >    - Do you want to collect these email bodies as they come in, or
> >      periodically from a 'mbox' file?
> >
> Hi There ,
> 
> I would like all email bodies in one file.Collect these email bodies
> as they come in, or periodically from a 'mbox' file? using cron.
> 
> I would lie cron to run the script and empty the mail user box in
> question to a file for extraction to a database.

Since your running Linux, you can simply do manual or periodic parsing
of mbox file and put the email bodies into 'file',
    formail -I '' -s < mbox >> file
Or, use Procmail recipe as email comes in,
    :0 b:
    * some_condition
    | cat >> file

Ref:
    man formail procmail procmailrc procmailex

Homework:
    Translate it to Python.

-- 
William Park, Open Geometry Consulting, <opengeometry at yahoo.ca>
No, I will not fix your computer!  I'll reformat your harddisk, though.



More information about the Python-list mailing list