Skip to content
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

[Mailer] EsmtpTransport TLS option #36005

Closed
Flower7C3 opened this issue Mar 9, 2020 · 5 comments
Closed

[Mailer] EsmtpTransport TLS option #36005

Flower7C3 opened this issue Mar 9, 2020 · 5 comments

Comments

@Flower7C3
Copy link

@Flower7C3 Flower7C3 commented Mar 9, 2020

Symfony version affected: 5.0.5

Description
I am not sure if it is really bug, or I am using something in wrong way. But when I want to setup EsmtpTransport with no TLS option it will be launched anyway. It was created on Aug 19, 2019 and still exists in master code.

@sebheitzmann

This comment has been minimized.

Copy link

@sebheitzmann sebheitzmann commented Mar 25, 2020

i've got the same error.

MAILER_DSN=smtp://mail.2le.net:25

and when I try to send something :

In SocketStream.php line 154:
                                                                                                     
  Warning: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:  
  error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed               
                                                                                                     
sebheitzmann added a commit to sebheitzmann/mailer that referenced this issue Mar 25, 2020
I thinks that this condition is false. We should not call startTLS if we are not in TLS.
see symfony/symfony#36005
sebheitzmann added a commit to sebheitzmann/symfony that referenced this issue Mar 25, 2020
I thinks that this condition is false. We should not call startTLS if we are not in TLS.
see symfony#36005

That's my first PR on symfony, so please say me if it's not the right way to do.
sebheitzmann added a commit to sebheitzmann/symfony that referenced this issue Mar 25, 2020
I thinks that this condition is false. We should not call startTLS if we are not in TLS.
see symfony#36005

That's my first PR on symfony, so please say me if it's not the right way to do.
@Flower7C3

This comment has been minimized.

Copy link
Author

@Flower7C3 Flower7C3 commented Mar 25, 2020

I find out one solution for this is to disable SSL verify_peer and verify_peer_name. But I still thinks that there is a bug in the code I mention above.

$socketStreamOptions = json_decode('{"ssl":{"verify_peer":false,"verify_peer_name":false}}');

 /** @var Transport\Smtp\EsmtpTransport $transport */
$transport = Transport::fromDsn($dsn);

/** @var Transport\Smtp\Stream\SocketStream $socketStream */
$socketStream = $transport->getStream();
$socketStream->setStreamOptions($socketStreamOptions);

$mailer = new Mailer($transport);
@stof

This comment has been minimized.

Copy link
Member

@stof stof commented Mar 25, 2020

Well, if your SMTP server advocates STARTTLS support but does not have a valid cert, the bug is in your SMTP setup, not in Symfony.

@sebheitzmann

This comment has been minimized.

Copy link

@sebheitzmann sebheitzmann commented Mar 25, 2020

Thanks for the advice. I will check that.

@sebheitzmann

This comment has been minimized.

Copy link

@sebheitzmann sebheitzmann commented Mar 25, 2020

It's ok. The posfix config was wrong. Sorry. You can close this issue

@xabbuh xabbuh closed this Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants
You can’t perform that action at this time.