Laravel 5邮件无法正常工作Swift_RfcComplianceException

时间:2015-05-04 11:52:41

标签: php laravel laravel-5 swiftmailer

我是新手使用laravel 5并尝试发送邮件,但我得到以下内容。错误:<span class="writer" data-writer-command="['PayPal?', 'Apple Pay?', 'Venmo?', 'Bitcoin?']">Ve</span>

我的控制器代码是

Swift_RfcComplianceException in MailboxHeader.php line 348:
Address in mailbox given [Kathmandu-Nepal] does not comply with RFC 2822, 3.6.2.

1 个答案:

答案 0 :(得分:5)

我遇到了同样的问题,问题是我在\ app \ config \ mail.php的邮件配置中有一个无效的电子邮件地址。所以请检查一下你的配置。

在我的情况下,配置包含如下内容:

/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/

'from' => ['address' => 'null', 'name' => 'Your Name'],

我通过设置有效的电子邮件地址来修复它:

/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/

'from' => ['address' => 'me@example.com', 'name' => 'Your name'],