Sending Emails

One endpoint sends to one or many recipients, with HTML, plain text, CC/BCC, attachments, and custom tags.

Requirements

  • The from address's domain must be verified — see Domains & DNS.
  • Your API key needs the emails:send permission.
  • Send must be within your plan's monthly quota (plus any purchased credits) — see Billing & Quota.

Request fields

ParameterDescription
from
stringrequired
Sender address on a verified domain. Accepts "Name <email>" or a plain address.
to
string | string[]required
One recipient or an array of recipients.
subject
stringrequired
Up to 998 characters.
html
string
HTML body. At least one of html or text is expected.
text
string
Plain-text body.
cc
string | string[]
CC recipients.
bcc
string | string[]
BCC recipients.
reply_to
string
Reply-To address.
tags
Record<string, string>
Custom key/value tags attached to the send, useful for filtering later.
attachments
Attachment[]
Files to attach — up to 20 per message, 40 MB total. See the Attachments guide.

Example

await cmdsend.emails.send({
  from: 'Acme <billing@yourdomain.com>',
  to: ['user@example.com'],
  cc: 'finance@example.com',
  subject: 'Your invoice is ready',
  html: '<p>Your invoice for March is attached.</p>',
  text: 'Your invoice for March is attached.',
  tags: { category: 'invoice' },
});

Attachments

Add an attachments array. Each file needs a filename plus either content (the bytes — the SDK base64-encodes a Buffer, Blob or File for you) or path (an https URL cmdsend downloads).

import { readFile } from 'node:fs/promises';

await cmdsend.emails.send({
  from: 'Acme <billing@yourdomain.com>',
  to: 'user@example.com',
  subject: 'Your invoice is ready',
  html: '<p>Your March invoice is attached.</p>',
  attachments: [
    { filename: 'invoice.pdf', content: await readFile('./invoice.pdf') },
  ],
});

Full walkthrough — uploads, inline images, limits and scanning — in the Attachments guide.

Delivery lifecycle

Every send moves through a status you can query via GET /v1/emails/:id:

queuedsentdeliveredopenedclickedbouncedcomplainedfailed

Full history is in Analytics & Logs.