IT & Tech

How to make analyzing your emails easier with Message-ID and tags?

Dariusz Sierka, 14 November 2022


Tracking the various metrics that relate to message deliverability (e.g. logging recipient server responses) allows you to see what happened to every single email sent from your system. A phone call from a worried client who hasn’t received an electronic invoice won’t cause you to panic, as you can check what happened to it in seconds in the EmailLabs user interface. It may be that the recipient’s mailbox is currently full and the email has been given a temporary status of ‘Deferred’, or you may have entered an address with a typo that caused a bounce – hence the ‘Hardbounce’ status.

To easily search for a specific message, a unique label, which is the Message-ID, must be stuck to it beforehand. However, such analytics at the lowest level, i.e. concerning a single message, is not always sufficient. To be able to look at the results from a broader perspective – e.g. assessing the engagement of recipients through opens and clicks on links – it is worth using tags.

These assign a label to a group of messages which meet the criteria defined by the rules. The results, e.g. for a specific newsletter campaign or certain action in transactional communication (account registration, purchase confirmation), help to draw valuable conclusions and optimize sendings accordingly. Any greater discrepancy between the number of e-mails sent (injected status) and received by the receiving server (ok status), as well as a sudden increase in soft or hard bounces, are clear signs that something worrying is going on.

Find out how you can analyze your mailings in a more sophisticated and aware way with the appropriate Message-ID and tagging of emails.

What is a Message-ID?

Message-ID is the unique identifier of a message, which should always be present in the message header. The Message-ID structure looks identical to an email address:

< [email protected]>

As you can see above, the fixed elements of a valid Message-ID are the characters “@” and “.”.

To ensure the uniqueness of the Message-ID, the timestamp (i.e. the time of the event), the receiving address, the subject or other tagging features can be used to construct it, e.g:


The uniqueness of the Message-ID is very important because, as mentioned in the introduction, it can be used to receive all the information and statistics from the EmailLabs interface relating to a particular email.

Every API method that provides information about a message can use the message_id(msgid) parameter to filter the data. It is not only the ability to retrieve data via API or from the EmailLabs interface that makes it worthwhile to have a valid Message-ID. Spam filters such as SpamAssassin, for example, check headers (including the Message-ID) and score them according to their content – for example:

Message-ID is unusually short MSGID_SHORT

Message-ID contains multiple ‘@’ characters MSGID_MULTIPLE_AT

The number of positive points awarded by SpamAssassin in the above examples is relatively small, but it is still worth ensuring that you do not receive them at all (the lower the score, the better).



Tags – the label that makes up a group

Unlike Message-ID, adding tags to an email is not required in any way, but their use allows messages to be tagged for later aggregation.

Adding tags to messages sent via EmailLabs is very simple. Whether the mailing is carried out via API or SMTP, the final data will be the same.

To add tags to messages sent via API, add the tags parameter in the body of the request:

‘tags’ => array(‘system’,’newaccount’)

The above example is a code snippet from PHP, but others are available in our documentation.

The same tags can be added to the message headers when sending via SMTP. Below is an example of a mailing using the PHPMailer library :

$mail->addCustomHeader(‘X-MAILTAGS’, ‘system;newaccount’);x

Regardless of the chosen method of sending the message, you will ultimately see an entry like this in the header section of the email:

X-MAILTAGS: system;newaccount

The information prepared in this way is stored in the EmailLabs panel so that it can be presented to users in aggregated form.

This data can be retrieve via API or viewed in the panel, making it possible to check, for example, the open rate for a given mailing, i.e., a specific tag.

When to use Message-ID and when to use Tags?

While (as mentioned earlier) Message-ID should always be used, Tags should be created when we know that we need to select specific data in the future. This could be campaign statistics or groups of emails with specific parameters. This is best illustrated by the following examples:

System emails

System emails can be labelled with the system tag, and if there are registration emails in this group, they can be additionally marked with another tag – newaccount (as in the previous examples). If there is a need to check the percentage of opens for registration e-mails or system e-mails in general, this can be done very quickly by downloading data only for the group so tagged.


The most common example of using tags is to label each newsletter campaign with a separate tag or a pair of tags, e.g.


In addition, if the newsletter is sent in Polish and English, a corresponding parameter can be added:


In this way, with just a few clicks, it is possible to see how a particular campaign is received by users (open rate/click rate) and how it compares to all newsletter mailings or other campaigns.

The examples are endless, but at the end of the day, it is always the same – tags aggregate emails into a group, which can be easily analyzed for statistics, then combined into larger groups and so on. How the tagging mechanism is used is up to the user’s imagination.

How to boost your email campaigns with tags?

An interesting concept is to use the tag mechanism as a diagnostic tool to improve the quality of email campaigns. Let’s assume that a mailing is performing poorly in terms of open rates. A recent campaign was given the tag HowToImproveMyEmailCampaigns1. Once you have made corrections, of any kind – whether to the content of the message or after adding mail security features such as SPF, DKIM, and S/MIME, you can tag the next campaign with HowToImproveMyEmailCampaigns2 and compare the results, has what has been changed to improve the quality of the campaign or should something else be done?

And is there a situation in which a tag should not be given?

Yes, if the message is not related to others or if there is no point in collecting statistics for a particular group of messages. Remember and beware of giving separate tags to each message, as this misses the point. Tags combine messages into groups, so an approach like the following would be inappropriate:

Message 1: tagNewsletter;client1
Message 2: tagNewsletter;client2
Message 2: tagNewsletter;client2
Message 3: tagNewsletter;client
Message 4: tagNewsletter;client
Message 5: tagNewsletter;client5

This makes it difficult to use the tag mechanism properly – the useful tags get lost in the clutter of the useless ones. What if we want information about a specific message? With help comes the Message-ID mentioned earlier, an identifier that provides very precise data about a particular message. Tags are very general but allow for a broader point of view.

Tags not only for developers

It may be the case that someone likes the concept of tags and would love to implement it in their mailings, but can’t do it from the code side, doesn’t employ a programmer and doesn’t have the necessary knowledge themselves. Nothing is lost, as tag messages’ functionality is available directly from the EmailLabs interface.

Under SMTP Accounts > Settings > Tags, you can add the appropriate rules.


Tag messages’ functionality is available directly from the EmailLabs interface.

Rule 1:

The tagging mechanism gives the tag TagsVsMsgid1 to messages that have exactly this line “Tags vs MessageId” in the subject field.

If the subject line looks like this then the tag TagsVsMsgid1 will not be given:

“Hello, you may be interested in our article Tags vs MessageId” or “Tags vs MessageId – what you need to know …. etc.”

Rule 2:

If the message has the subject line “Tags vs MessageId – or what you need to know …. etc.”, which is the same subject line as in the example above, the tag TagsVsMsgid2 will be given. Why?

The “*” symbol placed in the “Tags vs MessageId*” rule is important. This symbol means that there may be some additional characters in the subject field of the message beyond the searched “Tags vs MessageId” and therefore the message is to be given the tag TagsVsMsgid2.

Other examples:

Rule “Tags*MsgID” Subject: “TagsVSMsgID” Tagged? Yes
Rule “TagsVSMsg*” Subject: “TagsVSMsgID” Tagged? Yes
Rule “*giVSMsgID” Subject: “TagsVSMsgID” Tagged? Yes
Rule “TagsVSMsgID” Subject: “TagivsMsgID” Tagged? No
Rule “TagsVSMsgID” Subject: “TagsVSMsgID !” Tagged? No

Rule 3:

In the rule [email protected], the sending address of the message, i.e. the from field, is important.

When constructing rules relating to the field, the “*” symbol will not work.

Rule 4

It is almost identical to rule no. 1, except that – if the message is sent from the address “[email protected]” and with the subject “Great newsletter that will interest everyone”, the message will receive two tags (“newsletter” and “campaign1”). This will enable the aforementioned comparison of results.

Summary: Message-ID and tags

Message analytics can be simpler if you tag your emails in the right way. The Message-ID must always be present – in the right form and as a unique label so that it can be used to extract detailed and precise information about a particular message. Tags are used to bundle messages into groups and aggregate data on messages that meet the rules specified. They are optional and do not have to be included in the headers of emails, but their appropriate use can simplify the tracking of key metrics and, as a result, improve the effectiveness of mailings.

Create an account with EmailLabs today

Track your emails via Message-ID or Tags and boost your campaigns

Most popular

Latest blog posts