Python email archive

Sheila King usenet at thinkspot.net
Sun Feb 9 17:19:34 EST 2003


On 6 Feb 2003 18:30:07 -0800, jamesdean at hotmail.com (james) wrote in
comp.lang.python in article
<7c704489.0302061830.966153b at posting.google.com>:

> I want to archive all my incomming and out going emails to a
> postgreSQL Database. Does anyone have any scripts to help me get
> started.
> My plan so far is to:
> 1. invoke script from .forward file to parse header and body
> 2. Stick this in the database
> 
> for outgoing emails I presume there is a file like .forward I will do
> the same.

There is no such similar file for outgoing mails. At least, not that
I am aware of. The easiest thing to do, would be to Bcc all of your
outgoing mails to a particular email address for just that purpose, and
put a .forward file to invoke a script on the private, outbound BCC 
address.

> I'm not sure how I will cope with attachments.

I have an example script here:
http://www.aota.net/forums/showthread.php?postid=75098#post75098

which copes with certain types of attachments. Perhaps it will give you
some ideas.

It is also possible to use the email module, which has special features
for handling attachments. The email module is extremely well-written, but
due to its flexibility, and its object-oriented nature with many levels of
abstraction, may be difficult for some people to get used to.

The reason I didn't use it in the example above, is that the email module
installed on the server in question is older, and doesn't robustly handle
poorly formed messages.

> Any help/advice would be appreciated.

Good luck,


-- 
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/




More information about the Python-list mailing list