Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #5097

Py3k,email header handling

From TheSaint <nobody@nowhere.net.no>
Newsgroups comp.lang.python
Subject Py3k,email header handling
Followup-To comp.lang.python
Date 2011-05-11 16:04 +0800
Organization Aioe.org NNTP Server
Message-ID <iqdftv$age$1@speranza.aioe.org> (permalink)

Followups directed to: comp.lang.python

Show all headers | View raw


Hello,
some time ago, I wrote a program to eliminate undesided emails from the 
server(s) and leave those which comply to certain filter criteria.

I started it when I got to know whit Python 2.3. Now a days I'd like to 
spend some time to improve it, just for my interest, however it didn't 
gather anybody's interest before.
Now python 3.2 (and some version before) started to use byte, rather than 
text strings, almost for all data handling in compliance to unicode. My 
problem arise that my program handle text strings, so I'd like to rewrite 
the code

My program reads from IMAP4 or POP3 server, I'd prefer that a function/class  
will return either a list or a dictionary which contains the following 
fields:

'from', 'to', 'cc', 'bcc', 'date', 'subject', 'reply-to', 'message-id'

The list may be organized as tuple (from, its_content,), etc,etc for each 
field, but I think dictionary would be more efficient to use.

1) is there a way to call the IMAPlib or POPlib and pass the data directly 
to email.parser.HeaderParser to achieve my intention?

2) If the above will do, do re.compile compile unicode results?
I guess yes.

3) any related documentation...

-- 
goto /dev/null

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Py3k,email header handling TheSaint <nobody@nowhere.net.no> - 2011-05-11 16:04 +0800
  Re: Py3k,email header handling Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-05-11 13:44 +0000
    Re: Py3k,email header handling TheSaint <nobody@nowhere.net.no> - 2011-05-12 00:27 +0800
      Re: Py3k,email header handling Terry Reedy <tjreedy@udel.edu> - 2011-05-11 13:56 -0400

csiph-web