Laravel 5.7 No Verification Email sent

强颜欢笑 提交于 2019-12-13 03:19:18

问题


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!


回答1:


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; }



来源:https://stackoverflow.com/questions/54783476/laravel-5-7-no-verification-email-sent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!