Handling emails

Gerard Flanagan grflanagan at yahoo.co.uk
Mon Oct 23 15:07:31 EDT 2006


Fulvio wrote:
>
> Hello,
>
> I'd like to ask some clue to move further on my project :-)
> The purpose would be to gather all emails (local and remote ones) to do some
> backup.
> I've tried to get ideas by reading all about the modules enclose with python,
> but neither email framework nor mailbox give me the idea how to handle *one*
> email complete of payload and attachment (if any).

The 'PopClient' class here might help you:

   http://gflanagan.net/site/python/pagliacci/pagliacci.py.html

A script I use is here:

   http://gflanagan.net/site/python/pagliacci/getpopmail.py.html

There's a woeful lack of comments but hopefully you can figure it out!
It saves emails to the filesystem along with attachments.  (Note that
the POP account passwords are stored as plain text.) It checks a mail's
message-id and doesn't download if it already has been downloaded.

hth

Gerard




More information about the Python-list mailing list