I'm using laravel notifications for sending email and save to database. How to check mail status after sending email and how to save it in the notification table?
public function via($notifiable)
{
return ['mail', DbChannel::class];
}
public function toMail($notifiable)
{
return (new MailMessage)
->from('[email protected]', 'Example')
->line('...');
}
to handle this you can define listener and event . you first register it in App\Providers\EventServiceProvider
and then in App\Listeners\LogSendingMessage ,save send status. for example
also for LogSentMessage.... See this link for more information https://laravel.com/docs/8.x/mail#events