New submission from Robert:

email.utils.parseaddr() does not successfully parse a
field value into a (comment, address) pair if the
FROM header has 2 lines (or more) containing odd number of double quotes in 
each of them. 
The address in such tuple is not e-mail address but a part of comment.

For example:

"=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=
 =?UTF-8?Q?omo=C5=9Bci?=" <anita.wiecklin...@pato.com.pl>

is parsed into:

('', '=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=')

Full example on Python 2.7.12, email 4.0.2:

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from email.utils import parseaddr
>>> parseaddr('"=?UTF8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=\r\n 
>>> =?UTF-8?Q?omo=C5=9Bci?=" <anita.wiecklin...@pato.com.pl>')
('', '=?UTF-8?Q?Anita_=W4=86ieckli=C5=84ska_|_PATO_Nieruch?=')

When double quotes or \r\n are removed, header is parsed without problems.

The same issue exists on python 3.5.2 and email 6.0.0a1.

>From headers analysis I know that e-mail was made in Outlook 14.0 then send 
>through Exim 4.87 to outlook.com servers.

----------
messages: 299558
nosy: robertus
priority: normal
severity: normal
status: open
title: email.utils.parseaddr fails on odd double quotes in multiline header
versions: Python 2.7, Python 3.5

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue31089>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to