Closed Bug 1359774 Opened 4 years ago Closed 4 years ago

"@" in display name should cause display name to be quoted

Categories

(Thunderbird :: Message Compose Window, defect)

52 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(thunderbird_esr5254+ fixed, thunderbird53 wontfix, thunderbird54 fixed, thunderbird55 fixed)

RESOLVED FIXED
Thunderbird 55.0
Tracking Status
thunderbird_esr52 54+ fixed
thunderbird53 --- wontfix
thunderbird54 --- fixed
thunderbird55 --- fixed

People

(Reporter: nevoff89, Assigned: infofrommozilla)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170419190606

Steps to reproduce:

I send message to address which contain symbol "@" in field "display name".
For example:
TO: user@name <username@mail.org> 


Actual results:

I recived answer from e-mail server that's my message wasn't delivered. When i saw "sent messages" in field "TO:" thunderbird replace address from user@name <username@mail.org>  to user@ <"name username"@mail.org> 


Expected results:

I expect that my e-mail will send fine
OS: Unspecified → Linux
Hardware: Unspecified → x86_64
I can't reproduce this. I typed
huhu@huhu.com <jorkgk@jorgk.com>
into the To: field and the message got sent to
  To: "huhu@huhu.com" <jorkgk@jorgk.com>
and received correctly.

Can you try with add-ons disabled, see Help menu.
Summary: Can't send message with "@" in feild "display name" → Can't send message with "@" in field "display name"
It fine work if field "display name" contain ".<domain>" (TO: user@name.com <username@mail.org>), but if you try send message without ".<domain>" in field "display name" (TO: user@name <username@mail.org>) you reproduce the problem.
Hmm, yes, I tested the wrong thing, but
  To: jk@home <jorgk@jorgk.com>
works for me. Mail sent and received with no problem. Yes, the display part isn't quoted.
I tried debug Thunderbird smtp module and addresses in logfile looks fine(FROM:user1 <user1@mail.org>, TO:username@test <user2@mail.org>)
logfile:
2017-04-28 07:16:26.817323 UTC - 302016320[7ff010ba4340]: SMTP Send: MAIL FROM:<user1@mail.org> BODY=8BITMIME
2017-04-28 07:16:26.817759 UTC - 302016320[7ff010ba4340]: SMTP Send: RCPT TO:<user2@mail.org>

but from mail server i recived error message:

Messgage:
test user2@mail.org
Remote Server returned '550 5.1.3 STOREDRV.Submit; invalid recipient address'
Received: from mail.org ([fe80::f57a:6be4:9aa0:c7cb]) by
 mail.org ([fe80::f57a:6be4:9aa0:c7cb%13]) with mapi id
 15.00.1293.002; Fri, 28 Apr 2017 15:53:35 +0700
Content-Type: application/ms-tnef; name="winmail.dat"
Content-Transfer-Encoding: binary
From: =?utf-8?B?0JPRgNC40LPQvtGA0YzQtdCyINCU0LzQuNGC0YDQuNC5INCV0LLQs9C10L0=?=
 =?utf-8?B?0YzQtdCy0LjRhw==?= <user1@mail.org>
To: "username@" <test user2@mail.org>
Subject: testosmessages2
Thread-Topic: testosmessages2
Thread-Index: AQHSv/zr59OwrSamZ0aFIzo3EHTu3g==
X-MS-Exchange-MessageSentRepresentingType: 1
Date: Fri, 28 Apr 2017 15:53:35 +0700
Message-ID: <fe72aac4-296e-f05b-e08c-9acbe492bf5b@ftc.ru>
Accept-Language: ru-RU, en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator: <fe72aac4-296e-f05b-e08c-9acbe492bf5b@ftc.ru>
MIME-Version: 1.0
X-MS-Exchange-Transport-FromEntityHeader: Hosted
Thanks for using the logging option. So you're confirming that TB sends: TO:username@test <user2@mail.org>

I don't understand the log of your mail server, this is all Microsoft:
X-MS-Exchange-MessageSentRepresentingType: 1
X-MS-Has-Attach:
X-MS-TNEF-Correlator: <fe72aac4-296e-f05b-e08c-9acbe492bf5b@ftc.ru>
X-MS-Exchange-Transport-FromEntityHeader: Hosted
Accept-Language: ru-RU, en-US <=== *NOT* created by Thunderbird.

As I said, it works OK with the mail servers I've used.

However, reading RFC 2822, https://tools.ietf.org/html/rfc2822, I come to the conclusion that a string containing a "@" should be quoted. Here are the relevant definitions:
display-name    =       phrase
phrase          =       1*word / obs-phrase
obs-phrase      =       word *(word / "." / CFWS)
word            =       atom / quoted-string
atom            =       [CFWS] 1*atext [CFWS]
atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

Since @ is not listed in 'atext', it needs to go into a quoted-string.

Magnus, how do you read that?
Flags: needinfo?(mkmelin+mozilla)
Summary: Can't send message with "@" in field "display name" → "@" display name should cause display name to be quoted
Summary: "@" display name should cause display name to be quoted → "@" in display name should cause display name to be quoted
(In reply to Jorg K (GMT+2) from comment #5)
>   So you're confirming that TB sends:
> TO:username@test <user2@mail.org>

I have tested it with(copy%past/without the «»): 
«somename@domain <realaddress@emailprovider.de>»

and I can confirm, that TB does send:

| To: somename@domsain <realaddress@emailprovider.de>

Interestingly, TB creates the quotes when I add a TLD:
«somename@domain.com <realaddress@emailprovider.de>»

| To: "somename@domsain.com" <realaddress@emailprovider.de>

> As I said, it works OK with the mail servers I've used.

I tested it only with my local server.
 
> However, reading RFC 2822, https://tools.ietf.org/html/rfc2822, I come to

> Since @ is not listed in 'atext', it needs to go into a quoted-string.

Absolutely correct.
(In reply to Alfred Peters from comment #6)

> | To: somename@domsain <realaddress@emailprovider.de>
vs.
> | To: "somename@domsain.com" <realaddress@emailprovider.de>

The same behavior I have when these addresses are in the From/Reply-To header and I create a response:
=> Bug 1347331
(In reply to Alfred Peters from comment #6)
> and I can confirm, that TB does send:
> | To: somename@domsain <realaddress@emailprovider.de>
> Interestingly, TB creates the quotes when I add a TLD:
> «somename@domain.com <realaddress@emailprovider.de
Alfred, would you like to help us out with a patch?
It must be somewhere in
https://dxr.mozilla.org/comm-central/source/mailnews/mime/jsmime/jsmime.js
"@" is already included here:
https://dxr.mozilla.org/comm-central/rev/cd1e26a0cebec588bcd0076e5726b12f12b413a5/mailnews/mime/jsmime/jsmime.js#873
I thinks this is the brother of this change:
https://hg.mozilla.org/comm-central/rev/20692fa90366
There are a few unrelated white space changes. The test needs to be added in test_header_emitter.js:

+      [[{name: "user@domain", email: "user@d.com"}],
+        "\"user@domain\" <user@d.com>"],
+      [[{name: "Group", group: [{name: "u@d", email: "a@a.c"},
+                                {name: "u@c", email: "b@b.c"}]}],
+        "Group: \"u@d\" <a@a.c>,\r\n \"u@c\" <b@b.c>;"],
Well, I've almost done it myself now, but if you submit the patch, I can review it.

You run the test locally like this:
mozilla/mach xpcshell-test mailnews/mime/jsmime/test/test_header_emitter.js
If the name contains an "@", put it into quotes.
Attachment #8863328 - Flags: review?(jorgk)
Bug 1223136 is a Dupe of this Bug
Duplicate of this bug: 1223136
Thanks for the patch. I have run the whole test suite locally in that directory:
mozilla/mach xpcshell-test mailnews/mime/jsmime/test and it passed.
I also tried manually that the patch has the desired effect.

However, there are so many tests in TB that it's good to do a quick try run to avoid having to back it out later:
https://treeherder.mozilla.org/#/jobs?repo=try-comm-central&revision=b023a304fa3e0beef6b31809e36fc26269b522ad
Flags: needinfo?(mkmelin+mozilla)
Assignee: nobody → infofrommozilla
Comment on attachment 8863328 [details] [diff] [review]
Bug1359774_v1.patch

Try came out green. Thanks again!
Attachment #8863328 - Flags: review?(jorgk) → review+
https://hg.mozilla.org/comm-central/rev/fa94fa8799570d1cad75f2f44a667ff3f514779c
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 55.0
Comment on attachment 8863328 [details] [diff] [review]
Bug1359774_v1.patch

[Approval Request Comment]
Regression caused by (bug #): JS Mime and friends.
User impact if declined: xx@yy as display name not quoted, causes trouble with some MTAs.
Attachment #8863328 - Flags: approval-comm-esr52?
Attachment #8863328 - Flags: approval-comm-beta+
Attachment #8863328 - Flags: approval-comm-esr52? → approval-comm-esr52+
You need to log in before you can comment on or make changes to this bug.