Re: [Tutor] strip an email

2005-06-24 Thread Hugo González Monteverde
Hi nephish,

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.

something like:

#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.

Hugo

nephish wrote:
 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 .
 thanks
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] strip an email

2005-06-24 Thread Bill Campbell
On Fri, Jun 24, 2005, Hugo González Monteverde wrote:
Hi nephish,

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.

See http://docs.python.org/lib/module-email.html for easy ways to
handle e-mail.  The email module has utilities that make it easy
to handle headers and body.

something like:

#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.

Hugo

nephish wrote:
 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 .
 thanks
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
 
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


-- 
Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
UUCP:   camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:(206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``Good luck to all you optimists out there who think Microsoft can deliver
35 million lines of quality code on which you can operate your business.''
   -- John C. Dvorak
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor