Skip to main content
Use these examples when you know what you want to build and need the shortest path to a working implementation.

Send with cURL

Create an API key, authorize a domain, and send a message from your shell.

Send with Node.js

Send transactional email from a JavaScript or TypeScript application.

Send with attachments

Attach files safely and stay within the encoded message size limit.

Send HTML and plain text

Include both rich HTML and a plain-text fallback in the same message.

Send to multiple recipients

Use personalizations to address one or many recipients in a request.

Verify webhook signatures

Validate MailChannels webhook signatures before processing events.

Process bounces and complaints

Turn delivery events into suppression and review workflows.

Send via SMTP

Relay through MailChannels from tools that already support SMTP.

Common stack patterns

Production recipe checklist

Before you move an example into production:
  • Keep API keys in environment variables or a secrets manager.
  • Add Domain Lockdown for every sending domain.
  • Publish SPF, DKIM, and DMARC records.
  • Store the API response request_id.
  • Configure webhooks and persist raw events before business processing.
  • Add suppression handling for hard bounces, complaints, and unsubscribe events.
  • Document who owns support escalation for failed or delayed messages.