Add this in your config 'verify_peer' => false,
And did you followed the docs to install the packages: https://laravel.com/docs/9.x/mail#mailgun-driver
composer require symfony/mailgun-mailer symfony/http-client
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I am using laravel 9 + mailgun to send emails. I get this error
Symfony\ Component\ Mailer\ Exception\ TransportException
Unable to connect with STARTTLS: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
config in .env
MAIL_MAILER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=***
MAIL_PASSWORD=***
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=***
MAIL_FROM_NAME="${APP_NAME}"
config in config/mail
'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,
'auth_mode' => null,
'local_domain' => env('MAIL_EHLO_DOMAIN'),
],
what could be the problem and how can I solve this?
Add this in your config 'verify_peer' => false,
And did you followed the docs to install the packages: https://laravel.com/docs/9.x/mail#mailgun-driver
composer require symfony/mailgun-mailer symfony/http-client
Please or to participate in this conversation.