Skip to content

Send a basic email

The Send API v3.1 expects a JSON payload with a Messages array. Each object in Messages represents one message to process.

Required message properties

For each message, these properties are required:

  • From: JSON object with Email and optionally Name. The Email must be a previously validated and active sender. Format: { "Email": "value", "Name": "value" }.

  • To: array of recipient objects. Each recipient requires Email, and Name is optional. Format: [{ "Email": "value", "Name": "value" }, ...]. The same object structure applies to Cc and Bcc.

You must also provide one of the following content options:

  • TextPart and/or HTMLPart: message body in plain text and/or HTML. At least one must be present when not using templates. If only HTMLPart is provided, Mailjet does not generate a text part automatically.

  • TemplateID: ID of a Mailjet template. Use this when content comes from a stored template. When template content is used, do not set TextPart or HTMLPart.

Info

Important: The recipients listed in To will receive a common message, showing every other recipient and carbon copy (CC) recipients. If you do not wish the recipients to see each other, you have to create multiple messages in the Messages array.

Example: one recipient

This call sends a message to one recipient.

curl -s \
	-X POST \
	--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
	https://api.mailjet.com/v3.1/send \
	-H 'Content-Type: application/json' \
	-d '{
      "SandboxMode":true,
      "Messages":[
        {
          "From":{
            "Email":"pilot@mailjet.com",
            "Name":"Your Mailjet Pilot"
          },
          "HTMLPart":"<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
          "Subject":"Your email flight plan!",
          "TextPart":"Dear passenger, welcome to Mailjet! May the delivery force be with you!",
          "To":[
            {
              "Email":"passenger@mailjet.com",
              "Name":"Passenger 1"
            }
          ]
        }
      ]
	}'

API response

{
  "Messages": [
    {
      "Status": "success",
      "To": [
        {
          "Email": "passenger1@mailjet.com",
          "MessageUUID": "123",
          "MessageID": 456,
          "MessageHref": "https://api.mailjet.com/v3/message/456"
        }
      ]
    }
  ]
}

The response contains a Messages array. Each message result includes Status and per-recipient tracking metadata for To, Cc, and Bcc.

MessageUUID is the internal Mailjet ID of your message.

MessageID is the unique ID of the message (legacy format), which you can use to fetch more message details.

MessageHref is the API URL where message metadata can be retrieved. It includes the API base URL, message resource path, and message ID (not UUID).

Info

Notice: If you send an email to a contact that does not exist yet in Mailjet, the contact is automatically created and saved. If you plan to use that address later (for example in a contact list), there is no need to create it again.

Example: multiple recipients with Cc and Bcc

# This call sends a message to one recipient.
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"
								},
								{
										"Email": "passenger2@mailjet.com",
										"Name": "passenger 2"
								}
						],
						"Cc": [
								{
										"Email": "copilot@mailjet.com",
										"Name": "Copilot"
								}
						],
						"Bcc": [
								{
										"Email": "air-traffic-control@mailjet.com",
										"Name": "Air traffic control"
								}
						],
						"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>!</h3><br />May the delivery force be with you!"
				}
		]
	}'

API response

{
  "Messages": [
    {
      "Status": "success",
      "To": [
        {
          "Email": "passenger1@mailjet.com",
          "MessageUUID": "123",
          "MessageID": 456,
          "MessageHref": "https://api.mailjet.com/v3/message/456"
        },
        {
          "Email": "passenger2@mailjet.com",
          "MessageUUID": "124",
          "MessageID": 457,
          "MessageHref": "https://api.mailjet.com/v3/message/457"
        }
      ],
      "Cc": [
        {
          "Email": "copilot@mailjet.com",
          "MessageUUID": "125",
          "MessageID": 458,
          "MessageHref": "https://api.mailjet.com/v3/message/458"
        }
      ],
      "Bcc": [
        {
          "Email": "air-traffic-control@mailjet.com",
          "MessageUUID": "126",
          "MessageID": 459,
          "MessageHref": "https://api.mailjet.com/v3/message/459"
        }
      ]
    }
  ]
}