Parsing the body of an email

Cameron Laird claird at
Sun Nov 9 02:51:16 CET 2003

In article <vqqlsts381gc1 at>,
John Roth <newsgroups at> wrote:
>"BoBo the monkey" <coryvb123 at> wrote in message
>news:ad329f8a.0311081240.7ab628c2 at
>> I would like to know if anyone out there can give me an example or any
>> help with this. Using Python, I need to take the body of an email,
>> which has already been saved as a string, and parse it up into
>> different pieces which exist in said body.
>See the email package under the Internet Data Handling
>section of the Python Library Reference. It's section 12.2
>in the Python 2.2.3 manual set.
>John Roth

Mr. Roth, if I understand BoBo's original posting, his question
actually has nothing to do with e-mail, in our terms; he's just
trying to parse a long string that happened to originate within
an e-mail system.

BoBo, you described your message as segmented into several sec-
tions.  Do they always appear in the same order?  If so, a
regular expression will probably be handiest for this job.  If
not, you'll build a simple, simple finite-state machine, and
feed it the message a line at a time.

Cameron Laird <claird at>

More information about the Python-list mailing list