I am trying to send email from my laravel 5.1 system. I can send emails from my localhost and unable to send from the server. See my email configuration settings in .env file,
MAIL_DRIVER=smtp
MAIL_HOST= smtp.gmail.com
MAIL_PORT= 587
MAIL_USERNAME= username***@gmail.com
MAIL_PASSWORD= *********
MAIL_ENCRYPTION=tls
This configuration only work on my localhost. On server I am getting this error,
Swift_TransportException in StreamBuffer.php line 268:
Connection could not be established with host smtp.gmail.com [Network is unreachable #101]
I also try with changing MAIL_PORT
from 587
to 465
and MAIL_ENCRYPTION
from tls
to ssl
. But I am geeitng the same error. How can I fix this issue?
I solved my problem in cpanel using the code:
change MAIL_DRIVER=smtp to MAIL_DRIVER=sendmail in ".env" file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With