Send Email
Send an email to a single recipient. You can send from any address on a verified sending domain, or from the shared test sender.
curl https://api.connect.ms/v2/email \ -H "Authorization: Bearer $CONNECT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "sender": "hello@yourcompany.com", "recipient": "sam@example.com", "subject": "Your order has shipped", "content": { "html": "<p>Hi {{ first_name }}, your order is on its way.</p>" }, "template": { "data": { "first_name": "Sam" } }, "clientReference": "order-991" }'The response is 201 Created with the email as queued. Keep its id to look the email up or cancel it.
API reference: POST /v2/email
Content
Section titled “Content”Give content.html, content.text or both. Fill in {{ placeholders }} in your content with the values in template.data, written in Liquid.
To send a stored email template instead of content, give its name in template.name. See POST /v2/email/templates.
Set format to mjml to write your HTML in MJML. We convert it to HTML before sending.
kind says why you are sending the email: transactional (the default), marketing or authentication. Marketing email always carries an unsubscribe link.
Attachments
Section titled “Attachments”Add files in attachments, each with a filename, a contentType and the file content base64 encoded. Attachments can be up to 30 MB in total.
When sending fails
Section titled “When sending fails”The most common reasons for a 400 are:
- the sender’s domain isn’t verified (“Domain not approved for sending emails.”)
- the recipient is on your suppression list (“Recipient is on the suppression list.”)
- the content couldn’t be processed
The field at fault is named in errors. bypassSuppressions sends to a suppressed recipient anyway. Only use it when you have a good reason, such as a legal notice.
Scheduling and cancelling
Section titled “Scheduling and cancelling”Set scheduledAt to send later, more than 5 minutes and less than 3 months ahead. Email from the test sender can’t be scheduled.
DELETE /v2/email/{id} cancels a scheduled email that hasn’t been sent yet. Once it has been sent it can’t be cancelled, and you get a 409.