php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80751 Comma in recipient name breaks email delivery
Submitted: 2021-02-14 15:10 UTC Modified: 2021-02-15 09:34 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: camaro396 at yandex dot ru Assigned: cmb (profile)
Status: Closed Package: Mail related
PHP Version: 7.4.15 OS: Windows Server 2012 R2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: camaro396 at yandex dot ru
New email:
PHP Version: OS:

 

 [2021-02-14 15:10 UTC] camaro396 at yandex dot ru
Description:
------------
Comma in recipient name leads to a malformed SMTP FROM command.

Test script:
---------------
mail('"Lastname, firstname" <lastname_firstname@example.com>', 'TEST', 'TEST', 'From: "Test" <test@example.com>');

Expected result:
----------------
Message sent successfully

Actual result:
--------------
Message not sent.
SMTP transcript looks like this

"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"SENT: 220 mx.example.com"
"SMTPD"	56232	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"RECEIVED: HELO HOSTNAME"
"SMTPD"	56232	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"SENT: 250 Hello."
"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"RECEIVED: MAIL FROM:<sender@example.com>"
"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"SENT: 250 OK"
"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"RECEIVED: RCPT TO:<"Lastname>"
"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"SENT: 550 A valid address is required."
"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"RECEIVED: QUIT"
"SMTPD"	55224	293364	"2021-02-04 05:34:12.678"	"xx.xx.xx.xx"	"SENT: 221 goodbye"

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-14 21:19 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2021-02-14 21:19 UTC] requinix@php.net
What is the remote mail server software? The transcript suggests that it isn't parsing "Lastname, firstname" correctly as a quoted string.
 [2021-02-15 09:34 UTC] cmb@php.net
-Status: Feedback +Status: Verified -Assigned To: +Assigned To: cmb
 [2021-02-15 09:34 UTC] cmb@php.net
The problem is on our side.  SendText() splits the recipients on
comma[1], regardless of whether the comma is inside a quoted
string, or not.

[1] <https://github.com/php/php-src/blob/php-7.4.15/win32/sendmail.c#L412-L413>
 [2021-02-26 15:18 UTC] cmb@php.net
The following pull request has been associated:

Patch Name: Fix #80751: Comma in recipient name breaks email delivery
On GitHub:  https://github.com/php/php-src/pull/6735
Patch:      https://github.com/php/php-src/pull/6735.patch
 [2021-03-01 17:51 UTC] cmb@php.net
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=71297a254b8f0d97c028f3324cbaf95adf8de33c
Log: Fix #80751: Comma in recipient name breaks email delivery
 [2021-03-01 17:51 UTC] cmb@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 03:01:28 2024 UTC