Email filters in python

S

sf

Would someome like to post their email filters code. Its so common that
probably some standard library
supports it or many would have written it already. If I have basic
structure, I can take from there.

( Essentially I want get rid of XP by getting rid of powerful mail client
"TheBat!" )

...........................
- open POP-SSL connection to pop.someserver.com
- Get all mails and store as Unix mail file (mymails)
- do not delete mails from server
- close connection.
...........................
- open mymails file

- Do following for each mail in mymails file (one by one)
{
- get header fields: {FROM, TO, CC, Subject,... more ... }
- some conditons (FROM is found my addresslist.txt but not part of
my rejectlist.txt )
append that mail to some existing file.
}


...........................
- open SMTP-TLS connection to smtp.someserver.com
- send all mails in my unix mail file
- close connection
...........................


Thanks.
 
D

Diez B. Roggisch

..........................
- open POP-SSL connection to pop.someserver.com
- Get all mails and store as Unix mail file (mymails)
- do not delete mails from server
- close connection.
..........................
- open mymails file

- Do following for each mail in mymails file (one by one)
{
- get header fields: {FROM, TO, CC, Subject,... more ... }
- some conditons (FROM is found my addresslist.txt but not part of
my rejectlist.txt )
append that mail to some existing file.
}

For these two, use fetchmail and procmail.
..........................
- open SMTP-TLS connection to smtp.someserver.com
- send all mails in my unix mail file
- close connection

I'm not totally sure how to do this best - but here python might indeed
help, using smtplib and mailbox.
 
C

Christopher De Vries

I use fetchmail in daemon mode and have procmail set up to filter my
email through bogofilter (http://bogofilter.sourceforge.net/). As for
outgoing mail postfix, exim, and sendmail are popular. From my laptop I
do use a python script to cache mail my mail when I'm not connected. I
then use a script which sends my email over ssh to my work computer
which uses sendmail to send it all out. I discuss those scripts at
http://miyu.idolstarastronomer.com:8080/cgi-bin/cgiwrap/devries/blosxom.cgi/2004/04/27#laptop-mail
and they are written in python.
 
T

Thomas Guettler

Am Fri, 17 Dec 2004 15:07:26 +0000 schrieb sf:
Would someome like to post their email filters code. Its so common that
probably some standard library
supports it or many would have written it already.

Look for "getmail". This is a small python script which
is an alternative for fetchmail.

Thomas
 

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

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top