Laravel的邮件通知不会发送,但是Laravel的Mail :: Raw会发送 [英] Laravel's Mail notification won't send, but Laravel's Mail::Raw will

查看:1176
本文介绍了Laravel的邮件通知不会发送,但是Laravel的Mail :: Raw会发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Laravel的env文件中正确配置了SMTP服务器,并且可以使用Mail :: raw例如成功地发送电子邮件

I have configured my SMTP server correctly in Laravel's env file, and can successfully send an email using Mail::raw e.g.

Mail::raw("This is a test message", function ($message) 
{ 
    $message->from(env("MAIL_ORDER_ADDRESS"), 'Orders'); 
    $message->to('user@example.com'); 
    $message->subject('Test Message'); 
});

但是,当我使用laravel 5.3邮件通知时,没有收到电子邮件(也不会生成错误).我已经使用邮件陷阱在本地测试了相同的通知代码,并且通知可以正常工作.

However, when I use a laravel 5.3 mail notification, no email is received (nor is an error generated). I have tested the same notification code locally using mail trap and the notifications work correctly.

我不知道邮件服务器如何工作,并且可以与Mail :: raw一起使用,当我在本地测试并确认编码正确时,它不能自动处理通知.

I can't understand how if the mail server is working and can be used with Mail::raw, it doesn't automatically work with notifications when I have tested locally and confirm they are coded correctly.

注意:在NameCheap上使用共享托管.

Note: Using shared hosting on NameCheap.

有什么想法吗?

推荐答案

已修复:这是因为我没有在config/mail.php中配置发件人",并且由于域不匹配,所以未设置.

FIXED: It was because I had not configured "From" in config/mail.php and because the domains didn't match, it wasn't set.

这篇关于Laravel的邮件通知不会发送,但是Laravel的Mail :: Raw会发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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