Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pgogy's avatar

Email verification not working as expected

Hi all

I’m new here and new to laravel

Not using any starter kits and following https://laravel.com/docs/12.x/verification#model-preparation

The model code has everything from the above page but no email is sent. The registered function call is in the controller which is called because the view renders. I’ve written some code to test that email sending works. I wrote an event listener to listen for the registered event but that doesn’t fire.

Any thoughts on what I can do next?

I’m new so probably missing something very basic

0 likes
12 replies
tykus's avatar

Can you please share your code for the User model, Registration controller action, and for the Event Listener?

Madelynn's avatar

Welcome! A couple of things to check:

Make sure your User model implements MustVerifyEmail and that you’ve enabled the Illuminate\Auth\Events\Registered event when creating the user:

event(new Registered($user));

The built-in verification mail is only triggered by that Registered event — if you’re just doing $user->save() in your controller without firing the event, no email will go out.

Double-check your mail config in .env (e.g. MAIL_MAILER=smtp, host, port, credentials).

Run php artisan queue:work if you’re using queued mail.

You can test the listener with php artisan tinker or by manually firing Registered::dispatch($user).

Usually the missing step is firing the Registered event after the user is created.

1 like
pgogy's avatar

It's there - see paste bin links above

1 like
pgogy's avatar

Adding some more info

Went down trying to follow the route in the code

Seems for some reason the log driver is deprecations, and I see in my .env that

LOG_DEPRECATIONS_CHANNEL=null

I am not sure why the email would lead to that

1 like
tykus's avatar

I wrote an event listener to listen for the registered event but that doesn’t fire

Where is the Listener code?

How is your mailer configured; how did you prove that email sending works.

1 like
pgogy's avatar

I wrote a separate route just to send emails, and that sent emails, but someone on reddit pointed out that that works because it's not in a queue. I fixed the event listener firing as I didn't realise the event was illuminate\auth\something\registered and not just registered

This is my separate route

    Route::get('sendemail', function(){
	        $data = [
    	        'name' => 'John Doe',
        	    'message' => 'This is a test email from Laravel 12.'
    	    ];

	        Mail::to('[email protected]')->send(new Verify($data));
    	    Mail::to('[email protected]')->queue(new Verify($data));
    
	        return response()->json(['success' => 'Email sent successfully.']);
	    }
    );
pgogy's avatar

Mailer settings are

MAIL_MAILER=log MAIL_SCHEME=null MAIL_HOST=127.0.0.1 MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_FROM_ADDRESS="[email protected]" MAIL_FROM_NAME="${APP_NAME}"

pgogy's avatar

running queue:work doesn't bring any emails

Jsanwo64's avatar

Wait. is there a reason you are creating your own Auth and not using Laravel's Auth?

1 like
pgogy's avatar

I'm not creating my own, just not using breeze

pgogy's avatar

I fixed this, turns out you need to add routeNotificationForMail to the user model

Please or to participate in this conversation.