Title: email.utils.getaddresses fails for certain addresses
Type: behavior Stage: resolved
Components: email Versions: Python 2.7
Status: closed Resolution: duplicate
Dependencies: Superseder: email.utils.getaddresses behavior contradicts RFC2822
View: 11050
Assigned To: Nosy List: barry, japh44, r.david.murray
Priority: normal Keywords:

Created on 2013-01-22 23:51 by japh44, last changed 2013-01-23 13:24 by r.david.murray. This issue is now closed.

Messages (2)
msg180440 - (view) Author: Andreas Dewes (japh44) Date: 2013-01-22 23:51
email.utils.getaddresses doesn't seem to work if the quoted part of address contains "\r" or "\n" characters. An example:

from email.utils import getaddresses
address = '"Data Mining, Statistics, Big Data, and Data Visualization Group\r\n Members" <>'

In Python 2.7.3, this returns:

[('', u'Data Mining, Statistics, Big Data, and Data Visualization Group')]

Not sure if this is a real bug or if the address is malformed, in any case I encountered this issue when parsing e-mails fetched from GMail.
msg180458 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-01-23 13:24
It's sort-of a bug, and sort-of not.  getaddresses is expecting to parse an already unfolded header, but the pre-3.3 email package does not unfold headers automatically.  See issue 11050 for more information.
Date User Action Args
2013-01-23 13:24:49r.david.murraysetstatus: open -> closed
superseder: email.utils.getaddresses behavior contradicts RFC2822
messages: + msg180458

resolution: duplicate
stage: resolved
2013-01-22 23:51:42japh44create