I have the code below of sending email notification using email templates we have in our database.

Here the code.

$notificationClass = app($event['notificationClass']);
$notifiables = $notificationClass->getNotifiables();
Notification::send($notifiables, $notificationClass);

I tried to reduced it to most important line,

My question is on this line, Notification::send($notifiables, $notificationClass);

How do I know if the notification, in this case email, has arrived at their email or sent?

Is there a way to check that in laravel? I never find it in docs and I tried googling, don't find direct answer.

I tried something like

try {
    Notification::send($notifiables, $notificationClass);
} catch (\Exception $e) {
    return $e->getMessage();
}

But most cases, no log for exception, works fine on mailtrap, but when checked on gmail it simply doesn't arrived when sending it on testing environment, we used mailgun.

and on local, just mailtrap

I used laravel-5.5

Thanks

0 Answers