.env和mail.php文件不会更新-Laravel 5.1 [英] .env and mail.php files won't update - Laravel 5.1

查看:61
本文介绍了.env和mail.php文件不会更新-Laravel 5.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

几个月前,我开始了一个项目,并设置了发送邮件的配置,一切正常.但是现在我想更改发件人的电子邮件地址,因此我更改了.env和mail.php文件中的配置,但是laravel只是忽略了更新(仍使用旧配置发送邮件).我清除了缓存并重新启动了所有内容,甚至删除了这些文件,并且laravel继续使用已删除的文件配置发送电子邮件.我该怎么办?

I started a project a few months ago and set the configuration to send mail, everything works great. But now i want to change the sender email address, so i changed the configuration in the .env and mail.php files, but laravel just ignored the updates (still uses the old configuration to send mail). I cleared cache and restarted everything, I even deleted those files and laravel keeps sending emails with the deleted files configuration. What can i do?

.env:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=someaddress@gmail.com
MAIL_PASSWORD=******
MAIL_ENCRYPTION=null

config/mail.php:

return [

    'driver' => 'smtp',
    'host' => 'smtp.gmail.com',
    'port' => 587,
    'from' => ['address' => 'someaddress@gmail.com', 'name' => 'Some Name'],
    'encryption' => 'tls',
    'username' => 'someaddress@gmail.com',
    'password' => '******',
    'sendmail' => '/usr/sbin/sendmail -bs',
    'pretend' => false,

];

控制器:

Mail::send('emails.devolucion', ['datos' => $diet], function ($message) use ($diet){
        $message->to($diet['correo'], $diet['nombre'])->subject('Devolución');
});

我曾经有另一个地址,而不是"someaddress@gmail.com",而laravel一直使用那个旧的电子邮件地址,而不是新的电子邮件地址.它忽略了文件更新.

I used to have another address instead of "someaddress@gmail.com", and laravel keeps using that old email address instead of the new one. It is ignoring the files updates.

推荐答案

听起来好像正在缓存您的配置文件,然后Laravel从缓存中读取了它们,这就是为什么您的更新没有得到体现.

It sounds like your config files are being cached, and that Laravel is then reading them from the cache which is why your updates aren't being reflected.

我们可以使用以下命令告诉Laravel清除缓存并重新开始:

We can tell Laravel to clear the cache and start afresh using this command:

php artisan config:clear

这篇关于.env和mail.php文件不会更新-Laravel 5.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆