Parsing mime multipart/alternative emails for the message body

Joao Prado Maia JMaia at lexgen.com
Tue Jan 22 10:12:51 EST 2002


Hi,

I'm trying to parse mime based emails to get the message body, but I didn't
have much luck on trying to find a way. To give a little bit more detail,
what I'm trying to do is from a mime multipart email message get only the
message body. And by that I mean that I want only the message body, and not
the whole mime envelope for the other parts.

Using the modules mimify and rfc822 I can get the body, but it contains the
other parts as well. If the message was multipart/alternative with a part
text/plain and the other text/html, I would get both parts on the
rfc8222.Message().fp.read() way of doing this.

What I want is either just the text/plain body message on a
multipart/alternative or the text/html one if I don't have the choice.
Anyway, I looked into the new email module of Python 2.2 but I couldn't
figure out how to do this, if it is even possible.

Any suggestions would be greatly appreciated.

Joao

--
Joao Prado Maia
Software QA
Bioinformatics Dept.
Lexicon Genetics, Inc.


*************************************************************************** 
 The contents of this communication are intended only for the addressee and
may contain confidential and/or privileged material. If you are not the
intended recipient, please do not read, copy, use or disclose this
communication and notify the sender.  Opinions, conclusions and other
information in this communication that do not relate to the official
business of my company shall be understood as neither given nor endorsed by
it.  
*************************************************************************** 






More information about the Python-list mailing list