Python email archive
usenet at thinkspot.net
Sun Feb 9 23:19:34 CET 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
> 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
> I'm not sure how I will cope with attachments.
I have an example script here:
which copes with certain types of attachments. Perhaps it will give you
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.
More information about the Python-list