Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue11050] email.utils.getaddresses behavior contradicts RFC2822

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

May 15, 2012, 7:01 PM

Post #1 of 2 (111 views)
Permalink
[issue11050] email.utils.getaddresses behavior contradicts RFC2822

Changes by R. David Murray <rdmurray [at] bitdance>:


----------
assignee: r.david.murray ->
components: +email
nosy: +barry
versions: -Python 3.1

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue11050>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 28, 2012, 12:38 PM

Post #2 of 2 (104 views)
Permalink
[issue11050] email.utils.getaddresses behavior contradicts RFC2822 [In reply to]

R. David Murray <rdmurray [at] bitdance> added the comment:

The pre 3.3 email package does not do any header unfolding. You can make this work by doing the header unfolding before passing it to getaddresses:

>>> email.utils.getaddresses([''.join(m['to'].splitlines())])
[('A (B)', 'c [at] d'), ('', 'd [at] e')]

The new provisional policy that was just added to 3.3 (which will eventually become the standard interface) does do the unfolding before parsing the addresses, so it does not have this issue. In 3.3 we now have this:

>>> import email
>>> from email.policy import SMTP
>>> m = email.message_from_string("To: \"A\r\n (B)\" <c [at] d>, (A\r\n C) <d [at] e>\r\nSubject: test\r\n\r\nbody", policy=SMTP)
>>> m['to'].addresses
(Address(display_name='A (B)', username='c', domain='d.org'), Address(display_name='', username='d', domain='e.org'))

----------
resolution: -> fixed
stage: -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue11050>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.