473,394 Members | 1,083 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 long `To' and 'Cc' from email

Hi all. Im trying to develop yet another email filter. Just for fun for
now. Im having a little trouble parsing long 'To' and 'Cc' headers.
Sometimes p.e. the 'To' header comes like

'a*******@site.com, ac*****@site2.com'
others comes like
'"My self" <my********@self.net>, "My brother" <br*************@self.net>',
other times a \r\t comes inside the `To' header. And any combination of
the above mentioned (and shurely more) can ocur.

the email.* package dont seems to parse that kind of headers
`correctly'. What i want is to get a list with all the email address in
the `To' header.

Someone know if there is a more sofisticated parser for doing this?

Thanks!
Gerardo
Sep 6 '07 #1
1 1320
On Sep 6, 1:25 pm, Gerardo Herzig <gher...@fmed.uba.arwrote:
the email.* package dont seems to parse that kind of headers
`correctly'. What i want is to get a list with all the email address in
the `To' header.

Someone know if there is a more sofisticated parser for doing this?
If you're not interested in parsing the entire email message, you may
just want to run a regex on the message itself, looking for the "to"
header.

Here's a good start:

r"^to:\s*(.*)$"

You'll want to use the multi-line and case-insensitive options when
you use it.


Sep 6 '07 #2

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

Similar topics

29
by: Richard A. Huebner | last post by:
Is the unsigned long long primitive data type supported in ANSI standard C? I've tried using it a couple of times in standard C, but to no avail. I'm using both MS VIsual C++ 6, as well as the...
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...
8
by: lokeshrajoria | last post by:
Hello Friends, i am putting some problem here. can anybody know where i am wrong in this code. actully i am spliting string in this format as a sample.s37 file.here some format...
2
by: idorjee | last post by:
Hi, Can anyone please tell me how should I be parsing the following text file so that I could retrieve just the text following FUNCTION: and next two lines without the CC? ---------------------...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.