Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Mailer] Improve error message when SMTP server lacks SMTPUTF8 support#64186

Open
ousamabenyounes wants to merge 1 commit into
symfony:7.4from
ousamabenyounes:fix/issue-63215
Open

[Mailer] Improve error message when SMTP server lacks SMTPUTF8 support#64186
ousamabenyounes wants to merge 1 commit into
symfony:7.4from
ousamabenyounes:fix/issue-63215

Conversation

@ousamabenyounes
Copy link
Copy Markdown
Contributor

Q A
Branch? 7.4
Bug fix? yes
New feature? no
Deprecations? no
Issues Fix #63215
License MIT

When EsmtpTransport connects to an SMTP server that does not advertise the SMTPUTF8 capability (RFC 6531), sending a message whose envelope has any address with a non-ASCII local-part raises an InvalidArgumentException with this message:

Invalid addresses: non-ASCII characters not supported in local-part of email.

The wording is misleading: the addresses are RFC 6531 valid, and Symfony does support non-ASCII local-parts (see the docs). The real cause is server-side — the connected SMTP server has not advertised the SMTPUTF8 extension in its EHLO response, so the transport cannot use MAIL FROM:<…> SMTPUTF8.

This PR rewords the exception so the user can immediately see what the actual limitation is and search for "SMTPUTF8":

The SMTP server does not support the SMTPUTF8 extension required to send to addresses with non-ASCII characters in their local-part.

Reproduces with Tests/Transport/Smtp/EsmtpTransportTest::testMissingSmtpUtf8 (existing test). The test is updated to assert the new message.

Behaviour is unchanged: same exception class (Symfony\Component\Mailer\Exception\InvalidArgumentException), same throw site (SmtpTransport::doMailFromCommand).

@nicolas-grekas
Copy link
Copy Markdown
Member

I'd say for 8.2 as an improvement

@ousamabenyounes
Copy link
Copy Markdown
Contributor Author

Thanks for the review @nicolas-grekas — agreed, it's an improvement, not a bug fix.

8.2 isn't cut yet (8.1 BETA1 released 2026-05-06, no open PR targets 8.2 today). Should I:

  • retarget to 8.1 now so it forward-merges into 8.2 once the branch lands, or
  • hold this PR until 8.2 is cut?

Either way I'll update the Q/A table to reflect "Bug fix? no / New feature? yes" and add a Mailer/CHANGELOG.md entry under the chosen target.

@nicolas-grekas nicolas-grekas modified the milestones: 7.4, 8.2 May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants