473,408 Members | 1,873 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Email filters in python

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
4 1535
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
> ..........................
- 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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Robin Becker | last post by:
Hi, I'm getting vast numbers of fake upgrade emails containing some kind of virus. My rather old client can be made to reject these based on some patterns in the subject line. They're nearly all...
0
by: Aaron Straup Cope | last post by:
Hi, Included below is a copy of a message I sent to the py-tutor list. It didn't garner much in the way of a solution and it was suggested that this list might be helpful. Thanks, ...
1
by: Dieter Vanderelst | last post by:
Hello, I'm trying to access the Filters-Dll provided by the filters-project (http://filters.sourceforge.net/index.htm). Following the advice I got from the Python list -thank you for that-, I...
5
by: dananrg | last post by:
I would like to learn how to roll my own filter ala early 90's filters like Jive, Fudd, Kraut, Moron, etc, that take text as an input, and re-writes the text adding general hilarity of various...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.