-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Description
Laravel Version
12
PHP Version
8.4.3
Database Driver & Version
PostGres 16.9
Description
Hello,
I am new to laravel so this is potentially not an error, but it appears strangely coded.
I am using laravel with no starter kits or add ons, just the standard code base.
I am trying to send the user a verifyEmail when they register (as per https://laravel.com/docs/12.x/verification). The user model and controller are basically copies of the code on that page.
The view (register) completes, and the user is in the database. No email is received (and my email works in both send and queue as I've tested separately).
There issue seems to be in this section of code
if (! $notifiable->routeNotificationFor('mail', $notification) &&
! $message instanceof Mailable) {
return;
}
Which is in vendor/laravel/framework/src/Illuminate/Notifications/Channels/MailChannel.php
The message is not an instanceof mailable, because it's mailMessage (as per the buildMailMessage function in vendor/laravel/framework/src/Illuminate/Auth/Notifications/VerifyEmail.php
routeNotificationFor calls a function "method_exists", which looks for a function called "routeNotificationForMail" but the only functions with that name are in test libraries.
Steps To Reproduce
Install Laravel 12
in web.php
Route::get("/register", [ RegisteredUserController::class, 'create']);
Route::post("/register", [ RegisteredUserController::class, 'store']);
No email is sent, email has been tested using other code