-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Mailer] [Smtp] Add DSN option to make SocketStream bind to IPv4 #59482
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
100d478
to
a848d95
Compare
@@ -6,6 +6,7 @@ CHANGELOG | ||
|
||
* Add DSN param `retry_period` to override default email transport retry period | ||
* Add `Dsn::getBooleanOption()` | ||
* Add DSN param `source_ip` to allow binding to a specific IPv4 or IPv6 address. If you want to bind IPv4 without specifying an address, use `0.0.0.0`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second sentence does not belong to the changelog but to the documentation IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I have created a PR for the documentation: symfony/symfony-docs#20581
a848d95
to
93652bc
Compare
src/Symfony/Component/Mailer/Transport/Smtp/EsmtpTransportFactory.php
Outdated
Show resolved
Hide resolved
a8fc5a6
to
c50235a
Compare
Thank you @quilius. |
We are sending emails through a Microsoft connector, which verifies the sending server's IP address and sender email address. We started getting these error messages recently:
Apparently, our server started to connect using IPv6 and the connector only accepts IPv4 addresses. With this PR, we can force the SocketStream to connect to the smtp server via IPv4, by supplying an option in the DSN. Example usage:
This is my first PR to Symfony, so I tried doing my best to follow the guide.
From the errors I received, I think with DKIM signing IPv6 should be allowed as well. However, I do not have access the DNS records and needed a quick fix. This PR is based on a patch I did in my own project. Probably I will implement an available Microsoft Graph Transport in the future. But perhaps it's worth to keep this option available as well.