jhillyerd / enmime

MIME mail encoding and decoding package for Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to parse address with colon

lcd1232 opened this issue · comments

What I did: I have valid header From: =?utf-8?Q?re=3AStore=20?= =?utf-8?Q?Apple=20?= =?utf-8?Q?Premium=20?= =?utf-8?Q?Reseller?= <noreply@mail.restore.ru>

What I expected: Parsed successfully

What I got: error = mail: expected comma

Release or branch I am using: master

Comment: looks like we need to add quotes as it standard lib do

Example message:

Received: id 2D333CD836-1631660949
Message-Id: <20210915020909.0.20210915020909_pe_@CmKAw7AV7BGnRfumzamcPQ3185481631660948.escheclub.pegate>
Date: Wed, 15 Sep 2021 02:09:09 +0300
From: =?utf-8?Q?re=3AStore=20?=
 =?utf-8?Q?Apple=20?=
 =?utf-8?Q?Premium=20?=
 =?utf-8?Q?Reseller?= <noreply@mail.restore.ru>
To:  <user@example.com>
Subject: =?utf-8?Q?iPhone=20?=
 =?utf-8?Q?13=20?=
 =?utf-8?Q?Pro=2E=20?=
 =?utf-8?Q?=D0=9D=D0=BE=D0=B2=D1=8B=D0=B5=20?=
 =?utf-8?Q?=D0=BA=D0=B0=D0=BC=D0=B5=D1=80=D1=8B=2E=20?=
 =?utf-8?Q?=D0=9D=D0=B5=D1=80=D0=B5=D0=B0=D0=BB=D1=8C=D0=BD=D1=8B=D0=B5=20?=
 =?utf-8?Q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D0=B8=2E?=

Sorry for incredibly slow response on this, motivation has been scarce lately. :/ I spent a bit of time playing around with this and your #219 today.

I'm wondering if we need to take a step back, and figure out how much of our AddressList function is actually needed anymore. I don't think Go (properly?) decoded rfc2047 encoded headers back when it was originally committed in a09ca5e

There have been a number of updates to the built-in address decoding in Go since 2015, so we may want to delegate to it first, then try to fix things up if it fails.