17

I have an admin page on my site and I want an option to be able to manually resend an email verification, there are two purposes for this:

  1. Test email verifications templates.
  2. Debug user issues.

Does the user model have a method to do this?

Elliott Coe
  • 543
  • 3
  • 6
  • 18

1 Answers1

42

If your User model implements the MustVerifyEmail interface, yes, you can manually send the notification using:

$user->sendEmailVerificationNotification();
nakov
  • 13,938
  • 12
  • 60
  • 110
  • Call to a member function sendEmailVerificationNotification() on null – Sead Lab May 12 '20 at 08:28
  • @SeadLab yup, that means that you don't have a `user` on which you are calling the method on. So `$user` should be first found, either through the `Auth` or querying the database. – nakov May 12 '20 at 09:50
  • No, the problem is, I use this tutorial to add verification email feature https://www.5balloons.info/user-email-verification-and-account-activation-in-laravel-5-5/ Then, I realized, i am not be able to resend verification email. So I leave the tutorial above, and I just implements MustVerifyEmail, it work's like a charm. Now, I have another problem, I want to add feature for user who want to cancel the proccess of verification email. – Sead Lab May 12 '20 at 09:57
  • @SeadLab for that you can start a new thread by asking what exactly is your problem and what you have tried, so someone in the community can help you. – nakov May 12 '20 at 10:02
  • And what if your user model does not implement MustVerifyEmail? – DAVID AJAYI Aug 03 '20 at 21:17
  • It still works! Wow! After many hours... It works even without implementing MustVerifyEmail – DAVID AJAYI Aug 03 '20 at 21:33
  • Never exptected what I need just a single line of code – Catto Nov 26 '21 at 06:21