我有一个正确的电子邮件地址。我已经回显了它,但当我发送它时,我得到了以下错误:
Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
为什么?我使用laravel (swift mailer)发送电子邮件:
$email = email@address.com
然后当我发送它时,错误被抛出。
但是如果我直接使用字符串,它就会发送它。
下面是代码块:
Mail::send('emails.activation', $data, function($message){
$message->to($email)->subject($subject);
});
->with('title', "Registered Successfully.");
发布于 2019-01-14 21:05:28
已解决
Neos/swiftmailer:邮箱中的地址给定[]不符合RFC 2822,3.6.2
邮箱中/var/www/html/vendor/Packages/Libraries/swiftmailer/swiftmailer/lib/classes/Swift/Mime/Headers/MailboxHeader.php:地址的第261行出现异常,给定的[]不符合RFC2822,3.6.2。
private function _assertValidAddress($address)
{
if (!preg_match('/^'.$this->getGrammar()->getDefinition('addr-spec').'$/D',
$address)) {
throw new Swift_RfcComplianceException(
'Address in mailbox given ['.$address.
'] does not comply with RFC 2822, 3.6.2.'
);
}
}
https://discuss.neos.io/t/solved-neos-swiftmailer-address-in-mailbox-given-does-not-comply-with-rfc-2822-3-6-2/3012
https://stackoverflow.com/questions/21530566
复制相似问题