✨ NEW! Introducing Postmark’s Retention Add-on
x

Tags FAQ

What is a message tag in Postmark and what are they used for?

A message tag is a piece of information you pass in an API field or an SMTP header with the message request. Tags are used to categorize messages, for easy tracking, such as tagging all of your welcome emails with the tag 'welcome', or password reset emails with the tag 'reset'.

Keep in mind:

  • Each message can have one tag associated with it. So whenever you need more than one unique identifier for a message, you will want to use Metadata instead.
  • If you need to label each message with a unique label, this will cause too many filtering options, and lead to slower loading of the analytics/activity pages. Metadata would again be the answer here.

How do I add a tag when sending with the API?

Add your tag to the“tag” field in the body of your API call when sending an email. The tag is added to the“tag” JSON field in name/value pairs, as shown in this example request:

{
"From": "sender@example.com", 
"To": "recipient@example.com",
"Subject": "Email from Postmark with a tag",
"HtmlBody": "<a href=\"http://postmarkapp.com\">Go to Postmark</a>",
"Tag": "welcome_email",
"TrackOpens": "false",
"TrackLinks": "HtmlAndText"
}

How do I add a tag when sending via SMTP?

Tags can be used in SMTP messages, similar to the API. In order to use a tag for your message, you must include the tag in an SMTP header named X-PM-Tag. So your SMTP client must have the option to add this header. Most programming languages with SMTP modules include a method by which to add a custom tag to SMTP messages. Only one tag may be used per message. Here is how the SMTP header looks like:

X-PM-Tag: welcome_email

How to view tagged data and filter by tags?

  1. UI
    1. Statistics page:
    2. Activity page:


    3. You can filter from the Filters drop-down:

  2. API:
  3. You can filter your API results with tags in API calls such as the message search API, click/open APIs, bounces API, etc.).

  4. Webhooks:

    Wherever applicable, webhook data includes the message tag, such as delivery webhook, bounce webhook, open/click webhooks, Subscription

Last updated March 7th, 2023

Still need some help?

Our customer success team has your back!