Send email
POST/message-server/email/send
Sends an email to one recipient.
- Marketing and transactional emails: set
type. A marketing email needs the recipient's marketing consent and an unsubscribe link. - Placeholders: insert
{name}in the subject or the body and fill theplaceholdersmap. - Tracking: opens and clicks, at the level set in
trackingand allowed by the recipient's consent. - Scheduling: set
scheduledDateto send later. - Dry run: set
simulation: trueto validate the request without sending. - Consents: the request reads the recipient's consents on your contacts and records new ones there, creating the contact when needed, also in a dry run. See
consents.
A
202does not mean the email was accepted. A request that passes validation is answered202also when the email is rejected: checkresults.email.acceptedand, if it isfalse,results.email.reasons.
Request
Responses
- 202
- 400
- 401
- 403
- 500
- 511
Request accepted. Check results.email.accepted to see whether the email was accepted.
accepted: truemeans the email was accepted for sending, not that it was delivered: email has no delivery notifications yet.reasonsis present only when the email is rejected.
Invalid request. Fields that fail validation are listed in data, an object that maps the path of each invalid field (such as sendEmail.request.to) to its messages (a too long campaignId is reported as sendEmail.request.groupId); a body that cannot be read, for example a scheduledDate in another format or an unknown type, gives data: "Invalid request body". An error found while handling the email gives message and code instead: 24 for a from or replyTo that is not a valid address, or a body with both kinds of unsubscribe marker; 34 for a body.html longer than 1,048,576 characters, or with more than 50 distinct links to track; 35 when consents.marketing is false on a marketing email, which records the opt-out on your contacts.
Missing or invalid credentials. The body is empty.
Your account cannot send emails: code 36 when it is not enabled for email sending (a new account is not: contact support to enable it), code 102 when the platform cannot find it
Unexpected error while handling the email
The calling IP address is outside the IP ranges configured for your account