Description
Symfony version(s) affected
6.1
Description
When I set from address something like "中文" <admin@example.com>
, the from name 中文
does not display correctly.
The reason is
There are non-ASCII characters in the email address—The email address string must be 7-bit ASCII. If you want to send to or from email addresses that contain Unicode characters in the domain part of an address, you must encode the domain using Punycode. Punycode is not permitted in the local part of the email address (the part before the @ sign) nor in the "friendly from" name. If you want to use Unicode characters in the "friendly from" name, you must encode the "friendly from" name using MIME encoded-word syntax, as described in Sending raw email using the Amazon SES API. For more information about Punycode, see RFC 3492.
- from Amazon SES email sending errors
We have already stringify to addresses, and we should also stringify the from address.
$request = [
'FromEmailAddress' => $envelope->getSender()->toString(),
'Destination' => [
'ToAddresses' => $this->stringifyAddresses($this->getRecipients($email, $envelope)),
],
How to reproduce
send a email with from address name contain any non-ASCII chars, and the email will show a broken from name.
Possible Solution
stringify the from address
Additional Context
No response