Sending Emails
One endpoint sends to one or many recipients, with HTML, plain text, CC/BCC, attachments, and custom tags.
Requirements
- The
fromaddress's domain must be verified — see Domains & DNS. - Your API key needs the
emails:sendpermission. - Send must be within your plan's monthly quota (plus any purchased credits) — see Billing & Quota.
Request fields
| Parameter | Description |
|---|---|
fromstringrequired | Sender address on a verified domain. Accepts "Name <email>" or a plain address. |
tostring | string[]required | One recipient or an array of recipients. |
subjectstringrequired | Up to 998 characters. |
htmlstring | HTML body. At least one of html or text is expected. |
textstring | Plain-text body. |
ccstring | string[] | CC recipients. |
bccstring | string[] | BCC recipients. |
reply_tostring | Reply-To address. |
tagsRecord<string, string> | Custom key/value tags attached to the send, useful for filtering later. |
attachmentsAttachment[] | 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:
queuedsentdeliveredopenedclickedbouncedcomplainedfailedFull history is in Analytics & Logs.