How can I get text of the body (payload) of an email?

andrew blah andrew.stuart at xse.com.au
Sat Oct 16 05:00:52 EDT 2004


I'm puzzled.  Josiah suggested that this would allow me to get the
payload of an email message.

body = message.split('\r\n\r\n', 1)[1]

As I understand it, the headers of an email are terminated by a blank
line, after which comes the message payload.  A blank line being
represented by \r\n\r\n

After trying Josiah's above suggestion on many emails and failing to
get it to work, I found that in fact the following works:

self.raw_data.split('\n\n', 1)[0]

But this doesn't agree with my understanding of the RFC822 email
format, which is that the blank line should be represented by \r\n\r\n

Can anyone suggest where my understanding is wrong?
Thanks

Andrew Stuart




More information about the Python-list mailing list