email scanning for X-Spam-Score
Peter Otten
__peter__ at web.de
Mon May 25 07:17:32 EDT 2009
Helmut Jarausch wrote:
> my emails received from our mailing system contain a field like
>
> X-Spam-Score: -2.2
>
> Given the full email message in 'msg'
> I've tried
> mailmsg = email.message_from_string(msg)
> SPAM_CORE = mailmsg['X-Spam-Score']
> but it doesn't work.
What do you mean by "doesn't work"?
> What am I missing?
No idea. It seems to "work" over here:
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import email
>>> spam = open("spam.txt").read()
>>> m = email.message_from_string(spam)
>>> m["X-Spam-Score"]
'15.0 (+++++++++++++++)'
Peter
More information about the Python-list
mailing list