How can I get the response from Mailgun using Laravel mail. Here is my code.
// In User Model.
$mail = \Mail::send([], [], function ($message) use ($parsed_template) {
$message
->to('abhi@toemail.com')
->subject('Test')
->setBody($parsed_template, 'text/html')
->addPart('Hello, welcome to Laravel!', 'text/plain');
});
I can get the response in the Listener using the Mailgun EVENT.
protected $listen = [
Registered::class => [
SendEmailVerificationNotification::class,
],
'Illuminate\Mail\Events\MessageSent' => [
'App\Listeners\MailGunMailListner',
],
];
// 'App\Listeners\MailGunMailListner',
public function handle(MessageSent $event)
{
dd($event->message->getId());
}
I can get the response in the Listener, but I want to know how can I access it in the User Model.
Thanks