Laravel 5.7未发送验证电子邮件 [英] Laravel 5.7 No Verification Email sent

查看:123
本文介绍了Laravel 5.7未发送验证电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我注册用户或单击'单击此处以请求其他人'时,虽然使用答复,但没有发送验证邮件.'新的验证链接已发送至您的电子邮件地址. .我检查了.envconfig/mail.php文件,并使用修补程序和Mail::Send(...)成功地对其进行了测试.我还遵循了laravel 文档,并尝试了一些解决方案,在StackOverflow上对此进行了讨论.

  • 我的User扩展Authenticateable,实现MustVerifyEmail并使用Notifiable
  • 我的'RegisterController'在create function
  • 中显式调用$user->sendEmailVerificationNotification()
  • Auth::routes(['verify' => true]);添加到了web.php

我认为标准的sendEmailVerificationNotification实现存在问题,但是对于Laravel来说我太新了,无法弄清问题所在.

感谢您的帮助!

解决方案

我发现了我的错误:

我用自己的用户类替换了User.邮件地址的列名称为 mail_address ,与默认列名称不同.因此,我将此替代添加到了User:

public function routeNotificationForMail($notification) { return $this->email_address; }

When I register a user, or click 'click here to request another', no verification mail is sent, although it answers with 'A fresh verification link has been sent to your email address. ' . I checked my .env and config/mail.php file and successfully tested them with tinker and Mail::Send(...). I also followed the laravel documentation and tried some solutions, which were discussed here on StackOverflow.

  • My User extends Authenticatable, implements MustVerifyEmail and uses Notifiable
  • My 'RegisterController' explicitly calls $user->sendEmailVerificationNotification() in the create function
  • Added Auth::routes(['verify' => true]); to web.php

I assume, that there is something wrong with the standard sendEmailVerificationNotification implementation, but I am too new to Laravel to figure out what's the problem.

Thanks for your help!

解决方案

I found my mistake:

I swapped out the User with my own user class. The column name of the mail address is mail_address, which differs from the default column name. Therefore I added this override to my User:

public function routeNotificationForMail($notification) { return $this->email_address; }

这篇关于Laravel 5.7未发送验证电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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