没有在laravel 5.2中没有发件人地址的情况下无法发送消息,我已经同时设置了.env和mail.php [英] Cannot send message without a sender address in laravel 5.2 I have set .env and mail.php both
本文介绍了没有在laravel 5.2中没有发件人地址的情况下无法发送消息,我已经同时设置了.env和mail.php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在忘记密码的情况下,laravel发送电子邮件,显示错误消息:
In forgot password laravel sends email which gives error like :
Swift_TransportException in AbstractSmtpTransport.php line 162:
没有发件人地址就无法发送消息
Cannot send message without a sender address
我已经在.env
和mail.php
中都设置了我的邮件帐户详细信息.
i already have set my mail account details in .env
and mail.php
both.
我的.env:
MAIL_DRIVER=smtp
MAIL_HOST=smtp-mail.outlook.com
MAIL_PORT=587
MAIL_USERNAME=raval_himanshu@live.in
MAIL_PASSWORD=pass
MAIL_ENCRYPTION=tls
我的mail.php是
and my mail.php is
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp-mail.outlook.com'),
'port' => env('MAIL_PORT', 587),
'from' => ['raval_himanshu@live.in' => null, 'Himanshu Raval' => null],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol
|--------------------------------------------------------------------------
|
| Here you may specify the encryption protocol that should be used when
| the application send e-mail messages. A sensible default using the
| transport layer security protocol should provide great security.
|
*/
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
/*
|--------------------------------------------------------------------------
| SMTP Server Username
|--------------------------------------------------------------------------
|
| If your SMTP server requires a username for authentication, you should
| set it here. This will get used to authenticate with your server on
| connection. You may also set the "password" value below this one.
|
*/
'username' => env('raval_himanshu@live.in'),
'sendmail' => '/usr/sbin/sendmail -bs',
];
我也尝试过php artisan config:cache
,但是之后它给出了相同的错误.
i have tried php artisan config:cache
too but after that it gives same error.
推荐答案
我在mail.php
'from' => ['raval_himanshu@live.in' => null, 'Himanshu Raval' => null],
应该是
'from' => ['address' => 'raval_himanshu@live.in', 'name' => 'Himanshu Raval'],
这篇关于没有在laravel 5.2中没有发件人地址的情况下无法发送消息,我已经同时设置了.env和mail.php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文