In my .env
i have this configuration and everything works fine on localhost:
APP_ENV=local
APP_DEBUG=true
APP_KEY=******
DB_HOST=127.0.0.1
DB_DATABASE=dbname
DB_USERNAME=dbuser
DB_PASSWORD=*****
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_NAME=My app
MAIL_USERNAME=mail@private.com
MAIL_PASSWORD=*****
MAIL_ENCRYPTION=tls
But trying to send a mail online (I have GoDaddy as hosting) I get this error:
Swift_TransportException in StreamBuffer.php line 265:
Connection could not be established with host smtp.gmail.com [Connection refused #111]
I'm searching for a solution but can't still find the cause.
I'll suggest you change your port and encryption to the following:
MAIL_PORT=465
MAIL_ENCRYPTION=ssl
I had the same problem and this helped fixed it.
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.