email scanning for X-Spam-Score

Helmut Jarausch jarausch at igpm.rwth-aachen.de
Mon May 25 07:23:58 EDT 2009


Peter Otten wrote:
> 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
> 

Oh yes, thanks,
my test email was quite long and so I overlooked it contained 2 emails instead
of just one.

Sorry for the noise,
Helmut.


-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



More information about the Python-list mailing list