如何使用 Laravel Mail 获取 Mailgun 响应
如何使用 Laravel 邮件获取 Mailgun 的回复。 这是我的代码。
// In User Model.
$mail = \Mail::send([], [], function ($message) use ($parsed_template) {
$message
->to('[email protected]')
->subject('Test')
->setBody($parsed_template, 'text/html')
->addPart('Hello, welcome to Laravel!', 'text/plain');
});
我可以使用 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());
}
我可以在监听器中获得响应,但我想知道如何在用户模型中访问它。
谢谢
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('[email protected]')
->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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论