By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,192 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

Email filters in python

P: n/a
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.
Jul 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Fri, 17 Dec 2004 15:07:26 GMT, sf <sf@sf.sf> wrote:
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.


http://spambayes.sourceforge.net/

--
Cheers,
Simon B,
si***@brunningonline.net,
http://www.brunningonline.net/simon/blog/
Jul 18 '05 #2

P: n/a
> ..........................
- 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.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #3

P: n/a
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:8...27#laptop-mail
and they are written in python.

Jul 18 '05 #4

P: n/a
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
--
Thomas GŁttler, http://www.thomas-guettler.de/
Jul 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.