且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

试图让 Laravel 5 电子邮件工作

更新时间:2023-11-30 16:05:34

我知道它现在对你有用@Vantheman6 但是这对我有用,以防其他人也一样.

I know it's working for you now @Vantheman6 but this is what worked for me in case it's the same for someone else.

我在 .env 文件中添加了我正在使用的邮件服务的详细信息.所以请确保以下细节

I added to my .env file the details of the mail service I am using. So make sure the following details

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=MyUsername@gmail.com
MAIL_PASSWORD=MyPassword

在 .env 文件中是准确的.

in the .env file are accurate.

注意:不要忘记在编辑 .env 文件后重新启动您的服务器,以便它会选择您放入其中的新数据.

使用以下命令清除配置缓存:

php artisan config:cache

如果您不重新启动服务器,即使您进行了可能导致此错误的更改,.env 文件仍将继续向应用显示旧邮件数据.

If you don't restart your server, the .env file will still continue to present the old mail data to the app even though you have made changes that can cause this error.