user1978109
user1978109

Reputation: 737

Laravel 5.7 user verification email not sending at registrations time

I just upgraded from 5.6 to 5.7 and followed the instructions precisely. When registration happens, the email is not sending immediately. However, it works when clicking on the the message to resend it. Is it actually a feature to send the email at the point of registration? or Do I need to manually add a function.

Upvotes: 1

Views: 827

Answers (1)

Mozammil
Mozammil

Reputation: 8750

I checked the source, it seems it doesn't get dispatched upon registration automatically. However, you can easily change that behavior.

In app\Http\Controllers\Auth\RegisterController, your create() method should look like this. This should work, assuming that you have followed all the other steps documented here.

/**
 * Create a new user instance after a valid registration.
 *
 * @param  array  $data
 * @return \App\User
 */
protected function create(array $data)
{
    $user = User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => Hash::make($data['password']),
    ]);

    $user->sendEmailVerificationNotification();

    return $user;
}

Upvotes: 1

Related Questions