The following adheres to Send API v3.0
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.
| v3 | v3.1 | Comment |
|---|---|---|
| FromEmail | From['Email'] | |
| FromName | From['Name'] | |
| Sender | Sender | Change of format : used to be boolean. Now, it is an object, containing Email and Name properties. |
| Recipients | n/a | If you wish to send a message to many recipients, you need to create multiple instances of messages in the Messages property. |
| To, Cc, Bcc | To, Cc, Bcc | The SMTP style description of the recipients is replaced by a collection of recipients objects (with Email and Name property), nested in array. |
| Subject | Subject | |
| Text-part | Text-part | |
| Html-part | HTMLPart | |
| Mj-TemplateID | TemplateID | When 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-TemplateLanguage | TemplateLanguage | |
| MJ-TemplateErrorReporting | TemplateErrorReporting | Change 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-TemplateErrorDeliver | TemplateErrorDeliver | Change of the property type. It used to accept deliver or 0 as values. Now, it becomes a boolean property, which accepts true or false |
| Attachments | Attachments | Content-type becomes ContentType, content becomes Base64Content, content becomes Base64Content |
| Inline_attachments | InlinedAttachments | Content-type becomes ContentType, content becomes Base64Content, content becomes Base64Content |
| Mj-prio | Priority | |
| Mj-campaign | CustomCampaign | |
| Mj-deduplicatecampaign | DeduplicateCampaign | The value is now a boolean. |
| Mj-trackopen | TrackOpens | Change of format. It now accepts string, which is one of the following 3 values: account_default , disabled, enabled |
| Mj-trackclick | TrackClicks | Change of format. It now accepts string, which is one of the following 3 values: account_default , disabled, enabled |
| Mj-CustomID | CustomID | |
| Mj-EventPayLoad | EventPayload | |
| Headers | Headers | If you were using Headers to specify a Reply-To address, you should now use the ReplyTo property. No other changes. |
| Headers['Reply-to'] | ReplyTo | We 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) |
| Vars | Variables |
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.
{
"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" }]
}{
"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!"
}
]
}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.
{
"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" }
]
}{
"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!"
}
]
}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.