Closed Bug 1246228 Opened 5 years ago Closed 5 years ago

Email addresses must not be encoded


(Bugzilla :: Email Notifications, defect)

Not set



Bugzilla 4.4


(Reporter: stuart-bugzilla, Assigned: LpSolit)




(3 files, 2 obsolete files)

User Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0
Build ID: 20151102093252

Steps to reproduce:

Upgraded perl Encode from 2.78 to 2.80 (using Fedora 23 RPMs)
Using email submission method of sendmail, with exim 4.86.

Actual results:

Emails from my bugzilla installation started bouncing. Examining the bounces the mails were being sent to =?UTF-8?Q?stuart=40gmail=2Ecom?

Expected results:

It appears as if exim doesn't currently understand internationalized
email addresses using MIME encoded words. So not seeing a valid domain
in the address it appends the local domain before forwarding it.

The reason I'm seeing this now appears to be linked to the upgrade of the
perl Encode library. For example:
perl -E 'use Encode; print encode("MIME-Q", "stuart\") . "\n";'
using version 2.78 produces:
while on 2.80:
Keywords: qawanted
Considering this seems to impact several releases of the upstream module, we should have a work-around.
Assignee: email-notifications → dylan
Severity: normal → major
Ever confirmed: true
Duplicate of this bug: 1255328
I can confirm the issue with Encode 2.82. Using MIME-B or MIME-Header doesn't help.

@dan: you are the maintainer of the Encode module on CPAN. Could you tell us if this is a regression or an intentional change? If it's intentional, is there a way to fall back to the old behavior?
Keywords: qawanted

I suspect that the removal of

  if (   $word =~ /[^\x00-\x7f]/o ...

is responsible for this problem. It looks like headers are encoded in all cases.
Looks related to this:

Also, heh, See Also doesn't support RT?
(In reply to Dylan William Hardison [:dylan] from comment #5)
> Also, heh, See Also doesn't support RT?

It does, if the MoreBugUrl extension is enabled.
Based on, we might consider using
to handle encoding. 

As an immediate stopgap, we can specify (in Makefile.PL) that we need Encode < 2.80 for master,
and use the previous blacklisting feature for 5.0 branch.
The problem is on our side, not on Encode side, see As stated there, and as correctly done in Email::MIME::Encode already, only the phrase must be encoded, not the email address itself. But in Bugzilla::MIME, we encode the whole string, including the email address. So we are doing it wrong.
Flags: blocking5.0.3+
Target Milestone: --- → Bugzilla 5.0
Summary: Email addresses now always being sent using internationalized format → Email addresses must not be encoded
Attached patch patch for master, v1 (obsolete) — Splinter Review
header_str_set() has special code which correctly encodes what must be encoded, and leaves alone what must not be encoded, such as email addresses, see
Assignee: dylan → LpSolit
Attachment #8736340 - Flags: review?(dkl)
Attached patch patch for 5.0, v1 (obsolete) — Splinter Review
Attachment #8736347 - Flags: review?(dkl)
Flags: blocking4.4.12?
|use Encode::MIME::Header| is required by attachment.cgi to alter $Encode::Encoding{'MIME-Q'}->{'bpl'}. This missing dependency has never been caught before because Bugzilla::MIME was (luckily?) loaded before view() in attachment.cgi.
Attachment #8736347 - Attachment is obsolete: true
Attachment #8736347 - Flags: review?(dkl)
Attachment #8736873 - Flags: review?(dkl)
Attachment #8736340 - Attachment is obsolete: true
Attachment #8736340 - Flags: review?(dkl)
Attachment #8736874 - Flags: review?(dkl)
Comment on attachment 8736874 [details] [diff] [review]
patch for master, v1.1

Review of attachment 8736874 [details] [diff] [review]:

Attachment #8736874 - Flags: review?(dkl) → review+
Comment on attachment 8736873 [details] [diff] [review]
patch for 5.0, v1.1

Review of attachment 8736873 [details] [diff] [review]:

Attachment #8736873 - Flags: review?(dkl) → review+
Flags: approval5.0+
To ssh://
   6c14fac..60299ec  master -> master

To ssh://
   aa5f64e..652ee91  5.0 -> 5.0
Closed: 5 years ago
Resolution: --- → FIXED
Blocks: 1096384
Duplicate of this bug: 1269546
Dataloss (dropped email) qualifies for a backport in my opinion, unless there are architectural reasons that we can't.
Flags: blocking4.4.12? → blocking4.4.12+
Resolution: FIXED → ---
Target Milestone: Bugzilla 5.0 → Bugzilla 4.4
Attachment #8749602 - Flags: review?(dkl)
JFTR, I've tested the tip of the 4.4 branch and can confirm it suffers from the issue (email bounce). I can also confirm that LpSolit's patch fixes this.
Comment on attachment 8749602 [details] [diff] [review]
patch for 4.4, v1

Review of attachment 8749602 [details] [diff] [review]:

Confirmed fixed. r=dkl
Attachment #8749602 - Flags: review?(dkl) → review+
Flags: approval4.4+
To ssh://
   01ad7ac..f630337  4.4 -> 4.4
Closed: 5 years ago5 years ago
Resolution: --- → FIXED
Installed Bugzilla 5.0.3 today and I could verify the fix.
Duplicate of this bug: 1274954
Blocks: 1000988
You need to log in before you can comment on or make changes to this bug.