[Tutor] strip an email
Hugo González Monteverde
hugonz-lists at h-lab.net
Fri Jun 24 07:16:53 CEST 2005
I clearly remember it is very very simple and it is defined in the RFC.
As far as I remember, the end of the headers are signalled by an empty line.
Try looking for '\n\n', this should do the trick. I've saved a couple of
emails and it looks like this should work.
#full_text holds the full text of the message
bodypos = full_text.find('\n\n') + 2
body = full_text[bodypos:]
#body now holds the message body
Please let us know if this works, hope it helps.
> Does anyone know how to strip everything off of an email?
> i have a little app that i am working on to read an email message and
> write the
> body of a message to a log file.
> each email this address gets is only about three to five lines long.
> but i cannot seem to get just the body filtered through.
> i get all the headers, the path, what spam-wall it went through, etc...
> any suggestions would be greatly appreciated .
> Tutor maillist - Tutor at python.org
More information about the Tutor