I want to configure a custom email (not gmail) with TLS using Laravel and I can't make it work.
The error I get is:
stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:\nerror:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
In my .env
file I have:
MAIL_DRIVER=smtp
MAIL_HOST=mail.**********.com
MAIL_PORT=587
MAIL_USERNAME=system@**********.com
MAIL_PASSWORD=**********
MAIL_FROM_ADDRESS=system@**********.com
MAIL_ENCRYPTION=tls
I tried the same account in a non Laravel PHP project and it works just fine. In that project, I have this option that I think is the key:
$mailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mailer->SMTPAuth = true;
$mailer->SMTPSecure = 'tls';
How can I configure this options in Laravel? Or is another mistake? Thanks for your help.