Im using Postmark to send emails in my Laravel 8 app. Im looking for a way to hook into the email notification (note: this is the Laravel notification, not mail message) to add Postmark tag.
Accoridng to the Laravel notification doc, Laravel fires some events before/after sending notificaiton but I cant figure out a way to access the mail object.
Here are my code:
class NewOrderNotification extends Notification implements ShouldQueue
{
// ...
public function via($notifiable)
{
return ['database', 'mail'];
}
public function toMail($notifiable)
{
return (new MailMessage)->...
}
}
Note: I need to be able to differentiate between emails sent using Notification vs emails sent using Mail Message. Because I want to add different tags on different emails. E.g. emails sent to purchasers -> tag with "receipt", emails sent to recipiennt -> tag with "order", and all notification emails -> tag with "notification".
Thanks.