Closed Bug 1246228 Opened 8 years ago Closed 8 years ago

Email addresses must not be encoded

Categories

(Bugzilla :: Email Notifications, defect)

4.4.11
defect
Not set
major

Tracking

()

RESOLVED FIXED
Bugzilla 4.4

People

(Reporter: stuart-bugzilla, Assigned: LpSolit)

References

Details

Attachments

(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?=@example.com


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\@gmail.com") . "\n";'
using version 2.78 produces:
stuart@gmail.com
while on 2.80:
=?UTF-8?Q?stuart=40gmail=2Ecom?=
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
Status: UNCONFIRMED → NEW
Ever confirmed: true
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
http://search.cpan.org/diff?from=Encode-2.78&to=Encode-2.80&w=1#lib/Encode/MIME/Header.pm

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: https://rt.cpan.org/Ticket/Display.html?id=111853

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 https://github.com/dankogai/p5-encode/issues/28, we might consider using https://metacpan.org/pod/MIME::EncWords
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 https://rt.cpan.org/Public/Bug/Display.html?id=111853#txn-1611993. 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 http://cpansearch.perl.org/src/RJBS/Email-MIME-1.937/lib/Email/MIME/Encode.pm
Assignee: dylan → LpSolit
Status: NEW → ASSIGNED
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]:
-----------------------------------------------------------------

r=dkl
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]:
-----------------------------------------------------------------

r=dkl
Attachment #8736873 - Flags: review?(dkl) → review+
Flags: approval5.0+
To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   6c14fac..60299ec  master -> master

To ssh://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   aa5f64e..652ee91  5.0 -> 5.0
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Blocks: 1096384
Dataloss (dropped email) qualifies for a backport in my opinion, unless there are architectural reasons that we can't.
Status: RESOLVED → REOPENED
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://gitolite3@git.mozilla.org/bugzilla/bugzilla.git
   01ad7ac..f630337  4.4 -> 4.4
Status: REOPENED → RESOLVED
Closed: 8 years ago8 years ago
Resolution: --- → FIXED
Installed Bugzilla 5.0.3 today and I could verify the fix.
Blocks: 1000988
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: