【发布时间】:2020-12-20 18:17:07
【问题描述】:
我正在尝试让 Postmark 的新 Message Streams 与 Laravel 一起使用。
有没有办法将属性 + 值 '"MessageStream": "notifications" 添加到使用 Laravel 邮件发送的电子邮件的 JSON 正文中?我猜我需要以某种方式扩展 Mailable 类来做到这一点。
理想情况下,我希望能够在我的 Mailable 类中执行以下操作:
DiscountMailable.php
public function build()
{
return $this->from('hello@example.com')
->markdown('emails.coupons.created')
->subject('???? Your Discount')
->with([
'coupon' => $this->coupon,
])
->messageStream(
'notifications',
);
}
【问题讨论】:
-
你是否设法将消息流与 Laravel 一起使用?
-
是的。我刚刚添加了以下内容:->withSwiftMessage(function ($message) { $message->getHeaders()->addTextHeader('X-PM-Message-Stream', 'notifications'); });
标签: php laravel email postmark