Handling emails

TheSaint nobody at nowhere.net.no
Sun Jun 12 07:20:00 EDT 2011


Hello
I wrote a program which was working on python 2.x. I'd like to go for newer 
version but I face the problem on how the emails are parsed.
In particular I'd like to extract the significant parts of the headers, but 
the query to the servers had turned in to list of bytes.
What could be a method that will parse and return the headers into ascii if 
I'll pass the headers as bytes. Even I don't know whether I can pass as they 
arrive to the program.

For example if I try:

import poplib.POP3
_pop= poplib.POP3(srvr)
_pop.user(args[1])
_pop.pass_(args[2])

header =_pop.top(nmuid, 0)

This will return a list of bytes string and I don't have idea to process 
them in order to have a dictionary containing
'from', 'to', 'cc', 'bcc', 'date', 'subject', 'reply-to', 'message-id'
as keys.

-- 
goto /dev/null



More information about the Python-list mailing list