-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Mailer Transports to SMTP Cannot Establish Secure Connections #34846
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
Comments
maybe fixed by #34760? |
I applied the patch in #34760 without success in resolving this bug. |
I am experiencing this exact same issue using the following SMTP transport: $transport = new EsmtpTransport('smtp.office365.com',587,true); The error received is:
I am using Symfony version 5.0.1 and PHP version 7.3.11. The patch mentioned above did not help to correct the issue. |
Update: I ran my code again, but this time with the TLS option set to $transport = new EsmtpTransport('smtp.office365.com',587,false); However, when the patch is not applied, and TLS =
Does this working with TLS = |
@kbsanders But is the mail actually being sent? I can confirm that the error persists even with #34760. Setting TLS to false does indeed not result in the mentioned error and everything seems fine at first. But no mail is sent (no incoming mail on gmail nor activity visible on postmark). |
@toooni I believe it was working for me, but I ended up switching to Swift Mailer for the time being until Mailer matures a bit more. I could never get Mailer to work with TLS. Swift Mailer has no issues with TLS. |
To be clear, you should use |
…abpot) This PR was merged into the 4.4 branch. Discussion ---------- [Mailer] Fix STARTTLS support for Postmark and Mandrill | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #34846 <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | n/a Commits ------- 44b27c6 [Mailer] Fix STARTTLS support for Postmark and Mandrill
this solved my problem. i even told this solution to one.com support . thanks again |
yes, 465 is right , I use mailgun service in Laravel 7.X, the error is "Connection could not be established with host smtp.mailgun.org:stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number" and I use 465 replace Laravel init 587, the mistake was solved. |
This will make the mailer "auto-discover" the encryption capabilities of the SMTP server, allowing us to use port 587 with STARTTLS negotiation. Another solution would be to use port 465 with TLS set to `true`, but the [recommended way][1] is to use port 587 and let the library negotiate the encryption. See also symfony/symfony#34846 (comment) [1]: https://sendgrid.com/blog/whats-the-difference-between-ports-465-and-587/
I am also getting the same error. Where I will put these values? |
My SMTP Settings look like this MAIL_MAILER=smtp |
Pasting some part of the error. [2022-08-27 08:05:13] local.ERROR: Connection could not be established with host "ssl://smtpout.secureserver.net:465": stream_socket_client(): Unable to connect to ssl://smtpout.secureserver.net:465 (Connection timed out) {"exception":"[object] (Symfony\Component\Mailer\Exception\TransportException(code: 0): Connection could not be established with host "ssl://smtpout.secureserver.net:465": stream_socket_client(): Unable to connect to ssl://smtpout.secureserver.net:465 (Connection timed out) at /var/www/mysite.com/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:154) |
@hanzallahmsd did you try
|
it worked for me! |
MAIL_MAILER=smtp When I set env values like this, there is no error. but email not send to target email. |
…e STARTTLS (RFreij) This PR was merged into the 6.4 branch. Discussion ---------- [Mailer] [Mailjet] Disable tls for mailjet as it should use STARTTLS | Q | A | ------------- | --- | Branch? | 6.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Issues | <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT #52560 updates the default mailjet port and references the same change for mailgun. Similar to #51042 and with the same error message, the mailjet connection doesn't work now. The PR above already has a reference, but for completion sake: Ref #34846 (comment) for more explanation Commits ------- 709d56f fix(mailjet-smtp): disable tls for mailjet as it should use starttls instead
Symfony version(s) affected: 5.0.1
Description
When using the Transport out of the box, the Transport is unable to establish a secure connection. This issue looks similar to #34064
I am using OpenSSL 1.1.1d and PHP 7.4. I've reproduced the issue on PHP 7.3 as well.
The exact error message I receive is:
Connection could not be established with host "ssl://smtp.postmarkapp.com:587": stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
How to reproduce
The text was updated successfully, but these errors were encountered: