These are boxes in e-mail’s header allowing for e-mail message identification, e.g. its origin, date of send out etc. However these types of boxes can be created and used alone for specific data sending. Message-id is one of these boxes. In the example below we will show how you can use this box for your own needs and include data on e.g. what transaction in clearing system did a given message apply to.


What is Message-Id box?

It is a box holding a unique message number from a given server <> determined by sender’s server. Thanks to this we can see what is happening to our message during specific stages of delivery to the end user.


How to build custom Message-Id?

First of all we must take care of making our message id always unique. Moreover similar to how an e-mail address had a assigned domain:, additionally our unique number must be added between <> symbols, like here: <>. In order to learn more read about RFC standards.


A little bit of practice
Message-Id box apart form identification can also server other purposes. Think about what would we like to communicate in Message-Id box. Let’s assume that we will be sending a message to an online shop’s client who just purchased something. Basis for our unique client will be: transaction number (oid), user number (uid) and message’s send out time (time).

The data is encoded in JSON format

Naturally sending messages in such form is pointless, because it is highly possible that such identifier will be rejected by a server. The messages can be encoded using Base64. As a result we will receive the following character string:

Remember that the character string cannot be too long. Try to only enter essential data in the shortest possible format.

Having such character string we can start sending messages. Let’s write an easy script that will verify a send out with our custom message id number:

After a correct send out we are checking an inbox:

As can be seen Message-Id was accepted by a server (Gmail in this case). We can find out whether Message-Id already exists in a system, e.g. by using API. In order to start working with API read this article. Let’s write a short script that will do it for us and display results:

And here is the result:

Next by using only one line of code we can decode out Message-Id to its original form:

As a result we get the following: