Knowledge base

Email tagging

Email tagging becomes crucial when you start sending more emails. 

There are different types of transactional emails like password reminders, invoices or other email notifications. As your business grows, it might become difficult to find the analytics for each email.

MailerSend is here to help. You can tag your email message directly in your account or by using our Email API.

Email tagging from your account is simple. To get started:

  1. Navigate to Templates from the left-hand menu.

  2. Select the template you want to add the tag to and click Manage.

  1. Toggle the Default settings option on.

  1. Add your tags in the Template tags field. You can assign up to 5 tags.

  2. Click Save changes.

Email tagging with API

To tag emails using our API, pass the tags parameter in a JSON object with the rest of the data when sending an email through the MailerSend Email API. Check our Email API documentation to get more details about email tagging.

Please keep in mind that this parameter is an array of string. You can use more than one tag, but not more than 5. See our example code using the tags parameter:

{
	"from": {
		"email": "hello@mailersendapp.com",
		"name": "Your friends from MailerSend"
	},
	"to": [
		{
			"email": "john@mailersend.com"
		}
	],
	"settings": {
		"track_content": true
	},
	"subject": "Hello from {{company}}!",
	"text": "This is just a friendly hello from your friends at {{company}}.",
	"html": "This is just a friendly hello from your friends at {{company}}.",
	"tags": [
		"tag1",
		"tag2"
	],
	"personalization": [
		{
			"email": "john@mailersend.com",
			"data": 
				{
					"company": "MailerSend"
				}
			
		}
	]
}

Email tagging with SMTP

You can add a header to an SMTP message you send as follows:

X-MailerSend-Tags: "tag1, tag2, tag3"

You can send a maximum of 5 tags.

Note: This header must reside in the main MIME header node and not in additional MIME nodes like text/plain or text/html.

We recommend using tags such as password_reminder for your password reminder emails, or monthly_invoice for your monthly invoices. You can create any tag you like. Keep in mind that each tag should be unique for emails. You don’t need to generate unique tags for each email.

Once your tags are ready, you can apply them using filters in your Activity or Analytics pages.