Try chainging MAIL_DRIVER=mail
Don't forget to clear the config cache before testing it out.
php artisan config:clear
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm trying to send an email using the standard email feature in Laravel 5.4. I'm using smtp from google to send mails. When working local the email sends without a problem. But when I'm trying to do the same on my hosting I get the following error.
ErrorException in StreamBuffer.php line 94: stream_socket_enable_crypto(): Peer certificate CN=hostname' did not match expected CN=smtp.gmail.com'
My .env file
MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=***** MAIL_PASSWORD=**** MAIL_ENCRYPTION=tls
Thanks in advance.
Try chainging MAIL_DRIVER=mail
Don't forget to clear the config cache before testing it out.
php artisan config:clear
Please or to participate in this conversation.