[New-bugs-announce] [issue34155] email.utils.parseaddr mistakenly parse an email

Cyril Nicodème report at bugs.python.org
Thu Jul 19 10:53:43 EDT 2018


New submission from Cyril Nicodème <cx42net at gmail.com>:

Hi!

I'm trying to parse some emails, and I discovered that email.utils.parseaddr wrongly parse an email.

Here's the corresponding header:

> From: =?utf-8?Q?zq at redacted.com.cn=E3=82=86=E2=86=91=E3=82=86?=
 =?utf-8?Q?=E3=82=83=E3=82=85=E3=81=87=E3=81=BA=E3=81=BD=E3=81=BC"\=E3?=
 =?utf-8?Q?=81=A9=E3=81=A5=E3=81=A2l=E3=81=A0=E3=81=B0=E3=81=A8=E3=81?=
 =?utf-8?Q?=8FKL=E3=81=84=E3=82=8C=E3=82=8B=E3=82=86>KL=E3=82=89JF?=
 <mxvu at redacted2.com>

Once this has been parsed via `decode_header`, we obtain this value:

> From: zq at redacted.com.cnゆ↑ゆゃゅぇぺぽぼ"\どづぢlだばとくKLいれるゆ>KLらJF <mxvu at redacted2.com>

(I agree, not really a nice looking From email ...)

Then, when this value is given to parseaddr, here's the result:

> ('', 'zq at redacted.com.cnゆ↑ゆゃゅぇぺぽぼ')

But it should be:

> ('zq at redacted.com.cnゆ↑ゆゃゅぇぺぽぼ"\どづぢlだばとくKLいれるゆ>KLらJF', 'mxvu at redacted2.com')

(Note that the email in the "name" part is not the same as the email in the "email" part!)

----------
components: email
messages: 321956
nosy: Cyril Nicodème, barry, r.david.murray
priority: normal
severity: normal
status: open
title: email.utils.parseaddr mistakenly parse an email
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34155>
_______________________________________


More information about the New-bugs-announce mailing list