Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Parsing the body of an email

Reply
Thread Tools

Parsing the body of an email

 
 
BoBo the monkey
Guest
Posts: n/a
 
      11-08-2003
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.

=============================
Example:
This is basically what the email body looks like, simplified of
course.
.....
Summary:
========
This is the summary of the email.


Content:
========
This is another section of content in the email.


Date:
========
November 08, 2003
.....
=============================

I need to take out the detail of each section and save them as
seperate strings to be used elsewhere.

If anyone has any code examples that can get me started, or advice, or
any help at all it would be greatly appriciated. I'm very much a
novice in regards to Python and just don't know the language that well
yet.

Thanks in advance,
Cory
 
Reply With Quote
 
 
 
 
John Roth
Guest
Posts: n/a
 
      11-08-2003

"BoBo the monkey" <> wrote in message
news: om...
> 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


 
Reply With Quote
 
 
 
 
Cameron Laird
Guest
Posts: n/a
 
      11-09-2003
In article <>,
John Roth <> wrote:
>
>"BoBo the monkey" <> wrote in message
>news:. com...
>> 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 <>
Business: http://www.Phaseit.net
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: mbox parsing, specifically message body Emile van Sebille Python 0 06-14-2012 08:50 PM
To reduce your body weight & slim your body Loss weight MCSA 0 07-23-2007 07:54 PM
To reduce your body weight & slim your body Loss weight MCSA 0 07-21-2007 05:15 AM
all the text (including tags) between <body> .. </body> tarakparekh@yahoo.com Perl Misc 5 09-07-2005 11:40 PM
Not detecting body.scrollTop and body.scrollLeft in IE6 London Boy Javascript 2 01-12-2004 08:44 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57