简体   繁体   中英

Swift_TransportException Connection could not be established with host smtp.gmail.com [Connection timed out #110]

I am trying to send email in Laravel using Swift Mailer with markdown, i have been still trying from last 3 days but No Exact Solution found.

I have the .env file which is working properly in Local server. But, same env if I referred then I am getting above error.

I am not able to find what is wrong with my code.

Already Referred given solutions on google.

.env file:-

APP_NAME=Laravel
APP_ENV=local 
APP_KEY=xx 
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=xx
DB_DATABASE=xx
DB_USERNAME=xx
DB_PASSWORD=
BROADCAST_DRIVER=pusher
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=xxxxxxxxxxx
MAIL_PASSWORD=xxxxxxxx
MAIL_ENCRYPTION=tls
MAIL_ADDRESS=xxxxxxxxxxxx

You should create app password in google app password and use that password.

App password is a 16-digit passcode that gives an app or device permission to access your Google Account.If you use 2-Step-Verification and are seeing a “password incorrect” error when trying to access your Google Account, an App password may solve the problem. source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM