-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Closed
Description
Symfony version(s) affected
7.0
Description
The constructor of the EsmtpTransport offers the boolean parameter "tls", but even if configured to false, it switches to an encrypted connection if the server supports tls. This is an issue because if you try to connect to localhost, the certificate can not match and the connection fails with the exception: "SSL routines::certificate verify failed"
How to reproduce
Test on a system which accepts mail on localhost port 25, and that support STARTTLS:
<?php
use Symfony\Component\Mime\Email;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
require_once 'vendor/autoload.php';
$email = (new Email())
->from('test@example.com')
->to('test@example.com')
->subject('Test E-Mail')
->text('Test!');
$transport = new EsmtpTransport('localhost', 25, false);
$mailer = new Mailer($transport);
$mailer->send($email);
Possible Solution
In my opinion, the correct solution would be to either honor the tls parameter or not to verify the certificate, if the host is localhost.
Additional Context
No response