Verification email not being sent for api registration #49240
Unanswered
murraygunn
asked this question in
Q&A
Replies: 1 comment
-
Maybe this can help 👉 https://stackoverflow.com/questions/69992374/laravel-8-sendverificationemail-event-seemingly-not-firing |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've created a project with breeze and react, which works as expected. I've also created a react native app that works as expected apart from one thing. When a new user registers, they are created and the response is returned correctly. From telescope, it also appears that a mailable is created as part of the verification process, however it's never received. I've reproduced this with a minimal project as follows.
use Illuminate\Contracts\Auth\MustVerifyEmail;
class User extends Authenticatable implements MustVerifyEmail
Route::post('register', [RegisteredUserController::class, 'store']);
According to the docs at https://laravel.com/docs/10.x/verification#model-preparation,
event(new Registered($user));
should be enough to trigger the email properly, but it's not working for api requests. Nor is$request->user()->sendEmailVerificationNotification();
which should trigger the same thing manually.Since the event, listener and mail are all in Illuminate, I don't know how to troubleshoot them. I also tried using
Mail::assertSent()
from https://laravel.com/docs/10.x/mail#testing-mailable-sending, but I get an error saying that method doesn't exist. I've tried posting this in StackOverflow, but no one has responded, so I'm hoping there are more laravel-focused people here.Am I missing something in setting up my api (which works for everything else including sending an email I've set up myself)? How can I troubleshoot this further? Or is it a bug?
Beta Was this translation helpful? Give feedback.
All reactions