473,386 Members | 1,798 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,386 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 1319
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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
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...

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.