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

PatrickCaneloDigital's avatar

What does Mail:: handle different than ->notify()

In my Laravel11 App with Jetstream, FOrtify and Inertia, when a cronjob runs, mails are sent via Mail:: . These Mails are sent and received without any issue which shows me the basic mail and smtp config is correct But when I send mails via ->notify(), from the "frontend", for example for verifyEmail, the code runs without any error, but the mails get never received.

For testing purposes I first inserted a listener to MessageSending and MessageSent which showed correct format etc. So after pretty much headbanging I switched the smtp server to a Mailtrap smtp server and there the emails appeared, also in correct format, no blacklisting, 83.4% compatibility which proves to me that everything seems fine underneath in the code.

This makes me think it could be an issue with my smtp server, which is strange because it has no issues when Mails are sent from a cronjob with Mail::. Or is it the way that notify() handles the sending below the hood (I am using Inertia),, or because I am triggering the otify from the frontend and not a php artisan command

EDIT SOLUTION: I haven't the specific answer to why it does not work, but I switched the smtp credentials to another hosting I use, and there it woorked neetly, like in mailtrap. So apart from notify doing something slightly different, the specific hosting mailserver seems to play a role too, don't know how though

The route for sending the verificationEmail is as such

Route::post('/email/verification-notification', function (Request $request) {
    Log::debug('/email/verification-notification');
    $request->user()->sendEmailVerificationNotification();

    return back()->with('message', 'Verification link sent!');
})->middleware(['auth', 'throttle:6,1'])->name('verification.send');

and for testing purposes I overwrote the sendEmailVerificationNotification method as such, just to see if there is any issue.

public function sendEmailVerificationNotification()
{
    Log::debug('User sendEmailVerificationNotification');
    $this->notify(new VerifyEmail);
    Log::debug('Mail sent supposedly');
}

Any idea where to look now? That it works on mailtrap seems to point me to a mailserver issue, but then again: Mail::works fine, some emails are sent...

0 likes
2 replies
aleahy's avatar

Are you testing locally or on a server when you get it to succeed? The reason I ask is that I’m wondering if ShouldQueue is implemented on the notification, and if so, if you don’t have a queue worker running, no one will pick up the job and send it.

But usually the queue driver is sync when in a local dev environment to save you having to spin up a worker.

PatrickCaneloDigital's avatar

@aleahy I am testing locally... also I started the queue worker but nothing happened. only when I switched smtp server to mailtrap or another hosting (default was a bluehost mailaccount of mine) the mails were instantly sent over ->notify. So I am pretty sure it's the SMTP server kindof accepting the mail but not sending it out. I still wonder though why or how it can differentiate between a mail sent by Mail:: and ->notify()

Please or to participate in this conversation.