Skip to content
Last updated
Info

The following adheres to Send API v3.0

Send API v3 to v3.1

Send API v3.1 is not backward compatible with v3. Listed below are all the changes in implementation that should be carefully taken into account when migrating from v3 to v3.1.

Name and format of message property changes

v3v3.1Comment
FromEmailFrom['Email']
FromNameFrom['Name']
SenderSenderChange of format : used to be boolean. Now, it is an object, containing Email and Name properties.
Recipientsn/aIf you wish to send a message to many recipients, you need to create multiple instances of messages in the Messages property.
To, Cc, BccTo, Cc, BccThe SMTP style description of the recipients is replaced by a collection of recipients objects (with Email and Name property), nested in array.
SubjectSubject
Text-partText-part
Html-partHTMLPart
Mj-TemplateIDTemplateIDWhen using Send API v3, Mj-TemplateID accepts 2 formats. If an integer is provided, we will search for the ID of the template. If a string is provided, we will search for the Name of the template. When using Send API v3.1, TemplateID only accepts integer values, i.e. the ID of the template.
Mj-TemplateLanguageTemplateLanguage
MJ-TemplateErrorReportingTemplateErrorReportingChange of the property type. The destination of the error log should not be provided as string, but as object instead. Correct format: {Email, Name}
MJ-TemplateErrorDeliverTemplateErrorDeliverChange of the property type. It used to accept deliver or 0 as values. Now, it becomes a boolean property, which accepts true or false
AttachmentsAttachmentsContent-type becomes ContentType, content becomes Base64Content, content becomes Base64Content
Inline_attachmentsInlinedAttachmentsContent-type becomes ContentType, content becomes Base64Content, content becomes Base64Content
Mj-prioPriority
Mj-campaignCustomCampaign
Mj-deduplicatecampaignDeduplicateCampaignThe value is now a boolean.
Mj-trackopenTrackOpensChange of format. It now accepts string, which is one of the following 3 values: account_default , disabled, enabled
Mj-trackclickTrackClicksChange of format. It now accepts string, which is one of the following 3 values: account_default , disabled, enabled
Mj-CustomIDCustomID
Mj-EventPayLoadEventPayload
HeadersHeadersIf you were using Headers to specify a Reply-To address, you should now use the ReplyTo property. No other changes.
Headers['Reply-to']ReplyToWe added a property ReplyTo to allow you to specify more easily the Reply-To address. In V3, you would have had to use the Headers property to specify a Reply-To address. This property is a JSON object (with Email and Name property)
VarsVariables

Message encapsulation

Send API v3.1 allows only to send messages collection (bulk) no single message like v3 allowed. The message(s) will be encapsulated in a single property Messages containing a list of messages.

For a single message, v3 JSON payload:

API Response

{
  "FromEmail": "pilot@mailjet.com",
  "FromName": "Mailjet Pilot",
  "Subject": "Your email flight plan!",
  "Text-part": "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
  "Html-part": "<h3>Dear passenger, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!<br />May the delivery force be with you!",
  "Recipients": [{ "Email": "passenger@mailjet.com" }]
}

is now in v3.1:

API Response

{
  "Messages": [
    {
      "From": {
        "Email": "pilot@mailjet.com",
        "Name": "Mailjet Pilot"
      },
      "To": [
        {
          "Email": "passenger@mailjet.com",
          "Name": "passenger"
        }
      ],
      "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!"
    }
  ]
}

Deprecation of the Recipients message property

The Recipients property of a message object is not available anymore. To achieve the same behavior, multiple recipients receiving independently the same message, you will need to create several Messages objects with a "To" property.

For a single message, v3 JSON payload

API Response

{
  "FromEmail": "pilot@mailjet.com",
  "FromName": "Mailjet Pilot",
  "Subject": "Your email flight plan!",
  "Text-part": "Dear passenger, welcome to Mailjet! May the delivery force be with you!",
  "Html-part": "<h3>Dear passenger, welcome to <a href=\"https://www.mailjet.com/\">Mailjet</a>!<br />May the delivery force be with you!",
  "Recipients": [
    { "Email": "passenger1@mailjet.com" },
    { "Email": "passenger2@mailjet.com" }
  ]
}

should now be in v3.1:

API Response

{
  "Messages": [
    {
      "From": {
        "Email": "pilot@mailjet.com",
        "Name": "Mailjet Pilot"
      },
      "To": [
        {
          "Email": "passenger1@mailjet.com",
          "Name": "passenger1"
        }
      ],
      "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!"
    },
    {
      "From": {
        "Email": "pilot@mailjet.com",
        "Name": "Mailjet Pilot"
      },
      "To": [
        {
          "Email": "passenger2@mailjet.com",
          "Name": "passenger2"
        }
      ],
      "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!"
    }
  ]
}

Limitation size of JSON payload

The number of message objects authorized in the payload for Send API v3 is 100, also limiting the number of recipients ("To") authorized on one single Send API call. For Send Api v3.1 this limit is set to 50, as specified in its Message JSON Properties section.