email scanning for X-Spam-Score

H

Helmut Jarausch

Hi,

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 am I missing?

Many thanks for a hint,
Helmut.

--
Helmut Jarausch

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

Peter Otten

Helmut said:
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
 
H

Helmut Jarausch

Peter said:
Helmut said:
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
 
S

skip

Helmut> mailmsg = email.message_from_string(msg)
Helmut> SPAM_CORE = mailmsg['X-Spam-Score']

Maybe lower case?

SPAM_CORE = mailmsg['x-spam-score']
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top