]> granicus.if.org Git - php/commit
Fix #80751: Comma in recipient name breaks email delivery
authorChristoph M. Becker <cmbecker69@gmx.de>
Mon, 1 Mar 2021 15:18:40 +0000 (16:18 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Mon, 1 Mar 2021 17:46:21 +0000 (18:46 +0100)
commit71297a254b8f0d97c028f3324cbaf95adf8de33c
treed79731f1d753a65ecafdf13cf29dbbd49d871706
parent2c508c4d407e98a27ed2631ae88e2e10ee430003
Fix #80751: Comma in recipient name breaks email delivery

So far, `SendText()` simply separates potential email address lists at
any comma, disregarding that commas inside a quoted-string do not
delimit addresses.  We fix that by introducing an own variant of
`strtok_r()` which caters to quoted-strings.

We also make `FormatEmailAddress()` aware of quoted strings.

We do not cater to email address comments, and potentially other quirks
of RFC 5322 email addresses, but catering to quoted-strings is supposed
to solve almost all practical use cases.

Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
Closes GH-6735.
ext/standard/tests/mail/bug80751.phpt [new file with mode: 0644]
win32/sendmail.c