使用Mailgun插件将标签添加到WordPress电子邮件

I have written a WordPress plugin that sends various transactional emails that I would like to track. Depending on the email, I'd like to add a different tag. I am currently using the Mailgun WordPress plugin, however, in the admin settings, the tags seem to apply to all emails sent from the site.

It seems I have to add an 'og:tag' somewhere, but I can't work out where.

$to =           'theiraddress@theirdomain.com';
$subject =      'Test';

$message =      'This is a test message';

$headers[] =    'From: My Website <myaddress@mydomain.com>';
$headers[] =    'Content-Type: text/html; charset=UTF-8';

wp_mail($to, $subject, $message, $headers)

The Mailgun library documentation says to add an array of tags to the 'og:tag' element of the message array, but the WordPress plugin doesn't seem to use the Mailgun library. Do I add the tag as a header? If so, what's the format?

Looking at https://documentation.mailgun.com/en/latest/user_manual.html#sending-via-smtp I was able to see that the required header is 'X-Mailgun-Tag'.

Adding the code below has worked:

$headers[] =    'X-Mailgun-Tag: Test';

Looking at the link above, to add multiple tags, add multiple lines:

$headers[] =    'X-Mailgun-Tag: Test1';
$headers[] =    'X-Mailgun-Tag: Test2';

However, I haven't tested multiple tags.