python newbie, linux novice, needs to run spamassassin
finite.automaton at gmail.com
Fri Mar 17 04:05:31 CET 2006
I don't know spamassassin's exact set up, but usually procmail spam
filters read an email message from standard input and produce an exit
code that tells you if the message is spam or not.
So from the Python side, it should be as easy as running whatever the
command is (a quick googling suggests it is "sa-filter"), feeding it
the message on stdin, and capturing the exit code. Have a look at
Python's os.system, os.popen2, or os.popen3 fuctions. It may also be
the case that the filter emits a modified version of the email on
stdout containing spam-filter related headers.
Also, I'd recommend spambayes above spamassassin. Spambayes is a
statistical approach as opposed to Spamassassin's rule-based system*,
and for bonus point's it's written in Python.
* at this point someone will probably chime in saying it's possible to
rig spamassassin with a bayesian filter... probably so. I haven't
looked at it in years.
More information about the Python-list