3

我需要用户在注册后验证他们的电子邮件地址。我在用户表中有确认代码和确认字段。用户注册后如何发送电子邮件?

4

1 回答 1

8

您需要一个普通的刀片模板作为主体

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

只需confirmation_code在电子邮件中放置一个并定义一个路由,例如 mypage.com/emailverification/1389734jhikdfsjkb1234908adkb

当用户访问该链接时,您检查数据库中的该条目并将注册状态设置为已完成。

有关更多信息,请查看http://laravel.com/docs/5.1/mail#sending-mail

有关详细的教程检查:http ://bensmith.io/email-verification-with-laravel

于 2015-08-15T20:58:24.623 回答