Knowledge base

Custom headers

MailerSend Professional and Enterprise plan users can add unlimited custom headers to emails. This opens up new opportunities for personalization and advanced analytics.

What are custom headers?

Custom headers are additional pieces of information added to the header section of an email. These headers allow email senders to include unique identifiers, custom tracking codes, and other metadata that can be leveraged for detailed analytics, better email management, and enhanced personalization.

How to add custom headers

Adding custom headers in MailerSend can be accomplished through the API or SMTP settings. 

When sending an email via the MailerSend API, you can include custom headers by adding them to your POST request:

POST https://api.mailersend.com/v1/email
{
  ...
  "headers": [
    {
      "name": "X-Custom-Header",
      "value": "HeaderValue"
    }
  ],
  ...
}

Limitations

  • Custom headers must have a name and value, with names adhering to an alphanumeric format that can include hyphens

  • You will not be able to override default MailerSend headers

  • No spaces or invalid characters are allowed in header names

List-Unsubscribe headers

You can add custom List-Unsubscribe headers with the list_unsubscribe parameter.

For the URL method:

POST https://api.mailersend.com/v1/email
{
  ...
  "list_unsubscribe": "https://www.mailersend.com/unsubscribe",
  ...
}

For the mailto method:

POST https://api.mailersend.com/v1/email
{
  ...
  "list_unsubscribe": "mailto:unsubscribe@mailersend.com",
  ...
}

For more information on List-Unsubscribe headers, including how they work and how to add them, visit our guide on how to add a custom unsubscribe header.

Need more info?

Feel free to reach out to support@mailersend.com. A member of our support team will gladly assist you.