I'm using Laravel's built in login system (php artisan make:auth
) and I linked my Mailgun account for sending reset emails. But how can I define tags?
According to Mailgun's documentation tag needs to be added to function that sends emails.
https://documentation.mailgun.com/user_manual.html#tagging
'o:tag' => 'Password reset'
Where can I find that function and how to add o:tag
into it?
You can do it with headers. I am using Laravel 5.5 with Mailable
public function build()
{
$emailData = [
'subject' => $this->data['subject'],
'groupName' => $this->data['groupName'],
'acceptUrl' => $this->data['acceptUrl'],
'declineUrl' => $this->data['declineUrl'],
'email' => $this->data['email'],
];
return $this
->subject($this->data['subject'])
->markdown('emails.group.invitation')
->with($emailData)
->withSwiftMessage(function($message) {
$headers = $message->getHeaders();
$headers->addTextHeader("X-Mailgun-Variables", '{"type": "group-invitation"}');
$headers->addTextHeader("X-Mailgun-Tag", "group-invitation");
});
}