Laravel 5.7 - Verification email is not sent

Markus picture Markus · Sep 29, 2018 · Viewed 11.5k times · Source

I've upgraded my laravel instance from version 5.6 to version 5.7. Now I try to use the built-in email verification from laravel.

My problem is that I don't get an email after successful registration when I use the "resend" function the email arrives.

What is the problem?

Answer

JMoura picture JMoura · Oct 20, 2018

I had this exactly same problem. That is default code from Laravel.

In order to send the email after successful registration you can do this workaround:

at App\Http\Controllers\Auth\RegisterController

change this:

protected function create(array $data)
    {
        return User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);
    }

to this:

protected function create(array $data)
    {
        $user = User::create([
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ]);

        $user->sendEmailVerificationNotification();

        return $user;
    }