Mailrelay API Reference

Send email to one or more recipients

POST https://{account}/api/v1/send_emails

Authentication

Requires an API key sent in the X-AUTH-TOKEN header.

This method can be used to send an SMTP email from our API to one or more recipients.

The response will return an array with the details of each smtp email including the ID, which can be used to verify the status and tracking info later.

Parameters

NameTypeRequiredDescription
from object Yes From header
to array Yes To addresses. You can specify up to 100 recipients in one request.
subject string Yes Subject
html_part string No HTML part. This is required if text_part parameter isn't set.
text_part string No Plain text part. This is required if html_part parameter isn't set.
text_part_auto boolean No Set this to true in order to automatically generate plain text version of your message based on HTML content. If this is true, the you shouldn't send text_part parameter.
headers object No This may be used to set custom headers for your emails. Please note that the following headers are reserved and can't be used: `Authentication-Results, Bcc, Cc, DKIM-Signature, Date, Delivered-To, DomainKey-Status, From, List-Id, List-Unsubscribe, List-Unsubscribe-POST, Received, Received-SPF, Return-Path, Sender, Subject, To and User-Agent`.
smtp_tags array No SMTP Tags
attachments array No An array of attachments.<br><br>A message can contain up to <b>10 attachments</b>. Also note that:<br><br>- Sending large attachments ( more than 5mb ) can cause delivery issues since some servers may reject it.<br>- If your message has more than 100kb, it will use more credits from your package.<br>

Responses

StatusDescription
201 Success
400 The request is invalid. Check if the field names in the request and the request data is valid.
422 A validation error occurred. Check the response body for more information.
401 The API key wasn't sent or is invalid
429 Too many requests. You have exceeded the rate limit, wait and try again later.
500 An internal error happened. Try again later.
403 This endpoint requires the SMTP + API add-on package or a paid plan.

Response fields

NameTypeDescription
id integer ID
subscriber_id integer Subscriber
email string Email
created_at string Created at