v1

latestOpenAPI 3.1.02026-07-24700259.3 KB
EMAILS

Send a standard email

Send an email by passing a JSON email object

post/email/send

Request body

senderstring required

The name and email address to send from, in the format Name <name@example.com>

tostring[] required

An array of names and email addresses (up to 100) to send to, in the format Name <name@example.com>

ccstring[]

An array of names and email addresses (up to 100) to CC, in the format Name <name@example.com>

bccstring[]

An array of names and email addresses (up to 100) to BCC, in the format Name <name@example.com>

subjectstring

The subject of the email to be sent, <strong>Note:</strong> if <code>template_id</code> if passed this field is ignored.<br /><br />If you would like to set a custom subject in the <code>template_data</code>, use a variable (<code>{{custom_subject}}</code> for instance) as the value of the templates <em>subject</em> and then set its value in <code>template_data</code> respectively.

html_bodystring

A HTML encoded email body. Either <code>html_body</code> or <code>text_body</code> is required if <code>template_id</code> is not passed. If <code>template_id</code> is passed this field is ignored.<br><br> <strong>Warning:</strong><ul><li>To correctly track clicking of URLs you must: <ul><li>Enable click tracking for the API key</li> <li>Insert a full anchor HTML element (not just the URL)</li> <li>Include "https://" at the start of the HREF property</li> </ul></ul>

text_bodystring

A plain text email body. Either <code>html_body</code> or <code>text_body</code> is required if <code>template_id</code> is not passed. If <code>template_id</code> is passed this field is ignored.

template_idstring

The ID of the template you wish to use

template_datastring json

When a template_id is provided, include the pass-through values in the format {"variable1": "value1", "variable2": "value2"}

schedulestring

A timestamp that when passed allows you to schedule an email for sending. Must be in the future and within the next 3 days.<br />The api response will include a schedule_id property which can then be used alongside webhooks (An X-Smtp2go-Schedule-Id header is added to the sent email corresponds to this id). A total of 50,000 emails can be queued at any one time.

fastacceptboolean

If true, the email will be accepted immediately and sent in a background process. Use webhooks if you need information about final delivery to the recipient. This will soon become the default method of sending via API.

Example request

{
  "to": [
    "Jane Jones <jane@example.com>"
  ],
  "sender": "John Smith <john@example.com>",
  "subject": "My Test Email",
  "html_body": "<h1>Test <img src=\"cid:mypicture.jpg\" /></h1>",
  "text_body": "Test",
  "attachments": [
    {
      "filename": "report.pdf",
      "mimetype": "application/pdf",
      "fileblob": "bm90IGFjdHVhbGx5IGEgcGRm..."
    }
  ],
  "inlines": [
    {
      "filename": "mypicture.jpg",
      "mimetype": "image/jpeg",
      "url": "https://myserver.com/mypicture.jpg"
    }
  ],
  "schedule": "2025-09-10 13:15:00 +1200"
}

Response

Email sent

request_idstring required

Example response

{
  "request_id": "aa253464-0bd0-467a-b24b-6159dcd7be60",
  "data": {
    "succeeded": 1,
    "email_id": "1u0SwL-B9zBpi9ffUq-JAB2",
    "schedule_id": "caa928f4-24ec-4a68-bcfc-1fd2596342f0"
  }
}