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

Skip to content

[Mailer] SmtpTransport not encoding addresses #41651

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dmaicher opened this issue Jun 10, 2021 · 0 comments
Closed

[Mailer] SmtpTransport not encoding addresses #41651

dmaicher opened this issue Jun 10, 2021 · 0 comments

Comments

@dmaicher
Copy link
Contributor

dmaicher commented Jun 10, 2021

Symfony version(s) affected: 5.3.1 and older

Description
We recently moved from Swiftmailer to the Symfony mailer and we have issues with sending emails to domains that contain non-ASCII characters.

Example: something@öäü.com

Our local postfix receives this email address without any Punycode encoding end gives an error like

> RCPT TO:<something@öäü.com>\n
< 501 5.1.3 Bad recipient address syntax\r\n

I had a look and it seems the Symfony\Component\Mime\Encoder\IdnAddressEncoder is not used in this case to encode the addresses.

The SmtpTransport is just using the raw address: https://github.com/symfony/symfony/blob/5.3/src/Symfony/Component/Mailer/Transport/Smtp/SmtpTransport.php#L199

However the SwiftMailer transport was encoding the address first: https://github.com/swiftmailer/swiftmailer/blob/master/lib/classes/Swift/Transport/AbstractSmtpTransport.php#L383

With Swiftmailer the command looks like:

RCPT TO:<[email protected]>\n

So I'm wondering: Is there a reason we are not encoding addresses anymore?

@dmaicher dmaicher added the Bug label Jun 10, 2021
@fabpot fabpot closed this as completed Jun 23, 2021
fabpot added a commit that referenced this issue Jun 23, 2021
…aicher)

This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] fix encoding of addresses using SmtpTransport

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  |no
| Deprecations? | no
| Tickets       | Fix #41651
| License       | MIT
| Doc PR        | -

This fixes #41651 by using the same IDN encoding logic that was also used on SwiftMailer.

also see https://github.com/swiftmailer/swiftmailer/blob/master/tests/unit/Swift/Transport/AbstractSmtpTest.php#L430

Commits
-------

608a3e5 [Mailer] fix encoding of addresses using SmtpTransport
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants