[英]Laravel 5.6 SMTP Connection could not be established with host smtp.mailtrap.io
.env file: .env 文件:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=myuser
MAIL_PASSWORD=mypassword
MAIL_ENCRYPTION=TLS
I have done the following command to clear cache and config:我已经完成了以下命令来清除缓存和配置:
php artisan cache:clear
php artisan config:cache
php artisan config:clear
I get the following error我收到以下错误
Connection could not be established with host smtp.mailtrap.io [php_network_getaddresses: getaddrinfo failed: No such host is known.无法与主机 smtp.mailtrap.io 建立连接 [php_network_getaddresses: getaddrinfo failed: No such host is known.
I have also tried restaring local development server.我也试过重新启动本地开发服务器。
I do it like this: change the port and the encryption.我是这样做的:更改端口和加密。
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=[your username]
MAIL_PASSWORD=[your password]
MAIL_ENCRYPTION=null
And of course change username and password to your credentials.当然,将用户名和密码更改为您的凭据。
wrong code typo error错误代码错字错误
MAIL_HOST=smtp.mailtrap.io
MAIL_ENCRYPTION=NULL
and do this并这样做
php artisan cache:clear
php artisan config:clear
sudo service apache2 restart
It seems the server is not able to ping the destination address.服务器似乎无法 ping 目标地址。
Try to clear cache, config cache, and restart apache2.尝试清除缓存,配置缓存,重启apache2。 It will work fine.它会正常工作。
php artisan config:clear
php artisan cache:clear
sudo service apache2 restart
Note: clear browser cache & cookies as well.注意:也要清除浏览器缓存和 cookie。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.