Skip to content

Add Email Headers

In every message, you can specify your own Email headers using the Headers property. These headers will be added to the SMTP headers of the message, delivered to the recipient.

Only headers that don’t have a dedicated property in the message payload can be customized through the Headers property. In addition, some headers can’t be customized.

example

# This call sends an email to one recipient with an additional SMTP header
curl -s \
	-X POST \
	--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
	https://api.mailjet.com/v3.1/send \
	-H 'Content-Type: application/json' \
	-d '{
		"Messages":[
				{
						"From": {
								"Email": "pilot@mailjet.com",
								"Name": "Mailjet Pilot"
						},
						"To": [
								{
										"Email": "passenger1@mailjet.com",
										"Name": "passenger 1"
								}
						],
						"Subject": "Your email flight plan!",
						"TextPart": "Dear passenger 1, welcome to Mailjet! May the delivery force be with you!",
						"HTMLPart": "<h3>Dear passenger 1, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!<br />May the delivery force be with you!",
						"Headers": {
								"X-My-header": "X2332X-324-432-534"
						}
				}
		]
	}'

List of forbidden headers

FromSenderSubjectTo
CcBccReturn-PathDelivered-To
DKIM-SignatureDomainKey-StatusReceived-SPFAuthentication-Results
ReceivedX-Mailjet-PrioX-Mailjet-DebugUser-Agent
X-MailerX-MJ-CustomIDX-MJ-EventPayloadX-MJ-Vars
X-MJ-TemplateErrorDeliverX-MJ-TemplateErrorReportingX-MJ-TemplateLanguageX-Mailjet-TrackOpen
X-Mailjet-TrackClickX-MJ-TemplateIDX-MJ-WorkflowIDX-Feedback-Id
X-Mailjet-SegmentationList-IdX-MJ-MIDX-MJ-ErrorMessage
DateX-CSA-ComplaintsMessage-IdX-Mailjet-Campaign
X-MJ-StatisticsContactsListID