473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Parsing the body of an email

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
Jul 18 '05 #1
2 3085

"BoBo the monkey" <co*******@hotmail.com> wrote in message
news:ad**************************@posting.google.c 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
Jul 18 '05 #2
In article <vq***********@news.supernews.com>,
John Roth <ne********@jhrothjr.com> wrote:

"BoBo the monkey" <co*******@hotmail.com> wrote in message
news:ad**************************@posting.google. 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 <cl****@phaseit.net>
Business: http://www.Phaseit.net
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Bram Stolk | last post by:
Hi there, What could I use to parse CPP macros in Python? I tried the Parnassus Vaults, and python lib docs, but could not find a suitable module. Thanks, Bram
16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
0
by: cpavon | last post by:
Hello everyone, I am fairly new to MACT, I am currently trying to parse the oResponse.Body to retrive a dynamic values...store in an array and then randomly post those values. Does anyone...
1
by: yonido | last post by:
hello, my goal is to get patterns out of email files - say "message forwarding" patterns (message forwarded from: xx to: yy subject: zz) now lets say there are tons of these patterns (by gmail,...
0
by: Li-fan Chen | last post by:
Hi, We work with email in a large CRM solution and one of the email-related tasks that has plagued us is our decision to make use of a 3rd-party local-sourcer to work on the parsing of inbound...
3
by: binary_sunset | last post by:
Okay... so this may be all to obvious to all except myself, but I am having some difficulty with XML output from Adobe InDesign. Each separate article in my publication is tagged as an article,...
6
by: jackwootton | last post by:
Hello everyone, I understand that XML can be parsed using JavaScript using the XML Document object. However, it is possible to parse XHTML using JavaScript? I currently listen for DOMMutation...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: Ahmed, Shakir | last post by:
Thanks everyone who tried to help me to parse incoming email from an exchange server: Now, I am getting following error; I am not sure where I am doing wrong. I appreciate any help how to resolve...
3
by: GazK | last post by:
I have been using an xml parsing script to parse a number of rss feeds and return relevant results to a database. The script has worked well for a couple of years, despite having very crude...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.