3

I need users to verify their email address after registration. I have confirmation_code and confirmed fields in users table. How can I send an email after a user registration?

Ali Erfani
  • 682
  • 1
  • 11
  • 27

1 Answers1

8

You need a normal blade template being the body

Mail::send('emails.reminder', ['user' => $user], function ($m) use ($user) {
    $m->to($user->email, $user->name)->subject('Your Reminder!');
});

In just place a the confirmation_code in the email and define a route, e.g. mypage.com/emailverification/1389734jhikdfsjkb1234908adkb

When the user vists the link you check the database for this entry and set the status of the registration to completed.

For more information check http://laravel.com/docs/5.1/mail#sending-mail

For a detailed tutorial check: http://bensmith.io/email-verification-with-laravel

cre8
  • 13,012
  • 8
  • 37
  • 61