Email SMTP STARTTLS Issue

Please help! Recently changed the email setting(updated .env file), version V5.5.74-C108
But I still got following error.

[2023-04-02 16:17:17] production.ERROR: Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate CN=mi3-ss102.a2hosting.com' did not match expected CN=smtp-relay.sendinblue.com’ {“userId”:1,“exception”:"[object] (Symfony\Component\Mailer\Exception\TransportException(code: 0): Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate CN=mi3-ss102.a2hosting.com' did not match expected CN=smtp-relay.sendinblue.com’ at /home/xxxcom/invoice.xxx.com/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php:171)
[stacktrace]
#0 [internal function]: Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream->Symfony\Component\Mailer\Transport\Smtp\Stream\{closure}()
#1 /home/xxx/invoice.xxx.com/vendor/symfony/mailer/Transport/Smtp/Stream/SocketStream.php(174): stream_socket_enable_crypto()
#2 /home/xxx/invoice.xxx.com/vendor/symfony/mailer/Transport/Smtp/EsmtpTransport.php(139): Symfony\Component\Mailer\Transport\Smtp\Stream\SocketStream->startTLS()
#3 /home/xxx/invoice.xxx.com/vendor/symfony/mailer/Transport/Smtp/EsmtpTransport.php(105): Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport->doEhloCommand()
#4 /home/xxx/invoice.xxx.com/vendor/symfony/mailer/Transport/Smtp/SmtpTransport.php(253): Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport->executeCommand()

Hi

Which mail encryption are you using?

https://laracasts.com/discuss/channels/code-review/unable-to-connect-with-starttls-error-when-sending-email

MAIL_ENCRYPTION=“tls”

@david do you have any thoughts?

I’m not sure, looks like a configuration issue.

Which files should I configure/check? ty

@adf

The mail configuration is managed inside the .env file

There is also additional options available in config/mail.php if you need to extend / modify depending on the SMTP server you are using

'smtp' => [
            'transport' => 'smtp',
            'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
            'port' => env('MAIL_PORT', 587),
            'encryption' => env('MAIL_ENCRYPTION', 'tls'),
            'username' => env('MAIL_USERNAME'),
            'password' => env('MAIL_PASSWORD'),
            'timeout' => null,
            'local_domain' => env('MAIL_EHLO_DOMAIN'),
            'verify_peer' => env('MAIL_VERIFY_PEER', true),
        ],