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

mc.manganiello's avatar

Check if an email was sent

Hi. I'm using Illuminate\Notifications\Notifiable Trait of Laravel to send email from SMTP driver to 'smtps.pec.aruba.it' host. My code is:

$contact->notify(new TenderInviteesNotification());

Now I would control if the email was sent, if it is arrived to server (to avoid problem caused by the mail server for example). Is there a function in laravel like getFailure or others like this? Can anyone help me? Thank you in advance.

0 likes
4 replies
bashy's avatar

I think Mail::failures() may return something. You'll have to debug.

1 like
Jonjie's avatar

Hi @bashy . Can you link the Mail::failures() method here? Thanks

user3008's avatar

just add a failed() nethod in the notification itself. It will get called when the notification gets failed.


    public function failed($exception)
    {
        if ($exception instanceof Swift_TransportException) {
            // Email failed
        }
    }

Please or to participate in this conversation.