{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/smtp-relay/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Custom Headers","siteUrl":"https://dev.mailjet.com/","projectTitle":"Mailjet Developer Documentation","description":"Full reference for Mailjet SMTP custom headers: X-Mailjet-Campaign, X-MJ-CustomID, X-MJ-EventPayload, X-Mailjet-TrackOpen, X-MJ-TemplateID, and X-Mailjet-Prio.","image":"https://dev.mailjet.com/og-image.png","lang":"en-US","keywords":["Mailjet API","Email API","Content API","SMTP Relay","transactional email","email delivery","Send API","email templates","developer documentation"],"meta":[{"name":"og:type","content":"website"},{"name":"og:site_name","content":"Mailjet Developer Documentation"},{"name":"twitter:card","content":"summary_large_image"},{"name":"robots","content":"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"},{"name":"googlebot","content":"index, follow, max-snippet:-1, max-image-preview:large"}],"jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://dev.mailjet.com/#organization","name":"Mailjet","alternateName":"Sinch Mailjet","url":"https://www.mailjet.com","logo":"https://assets.mailjet.com/lib/images/mailjetLogo/mj_logo_with_text_color.png","parentOrganization":{"@type":"Organization","name":"Sinch","url":"https://www.sinch.com"}},{"@type":"WebSite","@id":"https://dev.mailjet.com/#website","name":"Mailjet Developer Documentation","description":"Official developer documentation for the Mailjet Email API, Content API and SMTP Relay.","url":"https://dev.mailjet.com/","inLanguage":"en-US","publisher":{"@id":"https://dev.mailjet.com/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dev.mailjet.com/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]},"llmstxt":{"hide":false,"title":"Mailjet Developer Documentation","description":"Developer documentation for the Mailjet Email API, Content API and SMTP Relay - guides, API references and code samples for sending, templating and tracking email at scale.","details":{"content":"Mailjet (part of Sinch) provides APIs for sending and managing email.\n\nThis documentation covers four main areas:\n\n- **Email API** - the Send API (v3 and v3.1) for transactional and marketing email,\n  plus contact management, segmentation, campaigns, statistics, webhooks, the Parse API\n  and the Mailjet Templating Language.\n- **Content API** - programmatic management of email templates, template contents,\n  images, labels and authentication tokens (v1).\n- **SMTP Relay** - sending through Mailjet's SMTP servers, including custom headers.\n- **API Reference** - the complete, generated reference for every endpoint, built directly\n  from the OpenAPI specifications.\n\nBase URL for all REST APIs: `https://api.mailjet.com`.\nAuthentication uses HTTP Basic auth with an API key and secret key.\n\n## Machine-readable entry points\n\nPrefer these when you need the API surface in as few requests as possible:\n\n- `/openapi/openapi-mailjet.md` - the **complete** Email API reference (every endpoint,\n  grouped by resource) as a single Markdown document.\n- `/openapi/openapi-passport.md` - the **complete** Content API reference as a single\n  Markdown document.\n- `/_bundle/openapi/openapi-mailjet.yaml` - the raw, fully bundled OpenAPI 3 description\n  of the Email API.\n- `/_bundle/openapi/openapi-passport.yaml` - the raw, fully bundled OpenAPI 3 description\n  of the Content API.\n- `/sitemap.xml` - every indexable URL on this site.\n\nEvery page on this site is also available as clean Markdown by appending `.md` to its URL."},"sections":[{"title":"Email API","description":"Sending, contacts, campaigns, statistics, webhooks and templating.","includeFiles":["docs/email-api/**/*.md"],"excludeFiles":[]},{"title":"Content API","description":"Manage templates, template contents, images, labels and tokens.","includeFiles":["docs/content-api/**/*.md","docs/content-api.md"],"excludeFiles":[]},{"title":"SMTP Relay","description":"Send email through Mailjet's SMTP servers.","includeFiles":["docs/smtp-relay/**/*.md"],"excludeFiles":[]},{"title":"API Reference","description":"Complete generated reference for every Mailjet API endpoint.","includeFiles":["openapi/openapi-mailjet.yaml","openapi/openapi-passport.yaml","docs/api-reference/**/*.md"],"excludeFiles":[]},{"title":"Migrating from Mandrill","description":"Guides for switching from Mandrill to Mailjet.","includeFiles":["docs/mandrill/**/*.md"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"custom-headers","__idx":0},"children":["Custom Headers"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"overview","__idx":1},"children":["Overview"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When using SMTP relay, you can use the following custom headers to specify how Mailjet will handle your message."]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Custom Header"},"children":["Custom Header"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-Mailjet-Campaign"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header value must be unique for all emails belonging to a specific campaign. This will regroup emails into only one line in your dashboard, and provide cool reports ! It can be an alphanumeric value of your choice (space, dash and underscore are also accepted), up to 255 characters long on one line"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-Mailjet-DeduplicateCampaign"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["In combination with X-Mailjet-Campaign, this boolean (true, yes, y, 1) indicates that you do not wish to send a message inside the campaign twice to the same recipient. In this case, we check that the recipient hasn’t been sent the message, or otherwise block any duplicate (only the first message goes through). Please note that this is based on recipient email address, it will not block a message sent to the same person on two different email addresses."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-CustomID"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This custom value will help you track your message more easily."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-EventPayload"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["If you need more than an ID, no problem: insert a payload to your messages, using any format (XML, JSON, CSV…)"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-Mailjet-TrackOpen"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header indicates whether or not you want to activate the open tracking on the concerned message. This option will override your tracking options set on your user account. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]},": disable the tracking. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]},": enable the tracking"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-Mailjet-TrackClick"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header indicates whether or not you want to activate or not the click tracking on the concerned message. This option will override your tracking options set on your user account. ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]},": disable the tracking ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]},": enable the tracking"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-Mailjet-Prio"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The header manages the different types of email by defining up to four priority levels. ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://app.mailjet.com/docs/email-priority-management"},"children":["More Information"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-TemplateLanguage"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header is related to the processing of the template language. It activates the template language processing. By default the template language processing is deactivated. Use ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["1"]}," to activate."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-TemplateID"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header allows you to pass the ID of the template stored on the Mailjet system."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-Vars"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header allows you to pass a JSON encoded array of variables that can be used with the templating language. Example: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{\"varname1\": \"value1\",\"varname2\": \"value2\", \"varname3\": \"value3\"}"]}]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-TemplateErrorReporting"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header is related to the processing of the template language. It defines the email address, to which a carbon copy with the error message is sent."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["X-MJ-TemplateErrorDeliver"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["This header is related to the processing of the template language. It defines if the message is delivered when an error is discovered in the templating language. By default the delivery is deactivated. Use deliver to let the message be ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["delivered"]}," to the recipient, ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["0"]}," to stop it."]}]}]}]}]}]},"headings":[{"value":"Custom Headers","id":"custom-headers","depth":1},{"value":"Overview","id":"overview","depth":2}],"frontmatter":{"title":"Mailjet SMTP Relay","seo":{"description":"Full reference for Mailjet SMTP custom headers: X-Mailjet-Campaign, X-MJ-CustomID, X-MJ-EventPayload, X-Mailjet-TrackOpen, X-MJ-TemplateID, and X-Mailjet-Prio.","title":"Custom Headers"}},"lastModified":"2026-08-26T10:53:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/smtp-relay/custom-headers","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}