0
votes

i'm using laravel with 000.webhost like a host i'm trying to send email but he shows me this error : Swiftmailer: Connection could not be established with host smtp.gmail.com [Connection timed out #110] my parameters in .env file are: MAIL_DRIVER=smtp

MAIL_HOST=smtp.gmail.com

MAIL_PORT=25

MAIL_USERNAME=my email

MAIL_PASSWORD=my password

MAIL_ENCRYPTION=tls

also in conf mail.php i use the same parameters i enabled less secure application in my account but still don't know where is the problem yet somewone can help me please ?

1
yes i did this but not working , the problem that i use another configuration on my local machine using wamp MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=email MAIL_PASSWORD=password MAIL_ENCRYPTION=ssl and it works fine i don't know why it dosn't work on 000.webhostsamix
@lftikhar uddin i'd checked this link and no one of the solutions can resolve my problem i think that because 000.webhost it's for free that's why the mail is blocked after the vérification of te host and DNSsamix

1 Answers

0
votes

I think you haven't enabled Less secure app access from your Gmail account. And change the SMTP mail settings as follows

MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=<YOUR EMAIL ADDRESS>
MAIL_PASSWORD=<YOUR PASSWORD>
MAIL_ENCRYPTION=tls

587 port number is for tls encryption

Now Follow these steps

  • Go to My Account
  • Then Sign in and security
  • Scroll down to the bottom and you will see Allow less secure app enable that one

Don't forget to run php artisan config:cache after you make changes in your .env file. That should fix your issue