Email Sending failed from cpnel but it works fine in my localhost.
Here is my email configuration in .env file.
MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=myemail@gmail.com MAIL_PASSWORD=mypassword MAIL_ENCRYPTION=ssl
It works fine in localhost but not working in cpanel. In cpanel it shows
Connection could not be established with host smtp.gmail.com [Connection refused #111]
How do i solve this?
Advertisement
Answer
Problem Solved. I made the change two things here MAIL_DRIVER and MAIL_PORT.
MAIL_DRIVER=sendmail MAIL_PORT=587
So, my full code is:
MAIL_DRIVER=sendmail MAIL_HOST=smtp.gmail.com MAIL_PORT=587 MAIL_USERNAME=myemail@gmail.com MAIL_PASSWORD=mypassword MAIL_ENCRYPTION=ssl
It works fine