Sending Emails
Send transactional and marketing emails using the Smail API.
Smail lets you send emails programmatically via a simple REST API. Every email is delivered through your verified sending domain, ensuring proper authentication (SPF, DKIM).
Required fields
| Field | Description |
|---|---|
from | Sender address — must be on a verified domain |
to | Array of recipient addresses |
subject | Email subject line |
html or text | Email body — at least one is required |
Optional fields
| Field | Description |
|---|---|
cc | Carbon copy recipients |
bcc | Blind carbon copy recipients |
reply_to | Address replies are sent to |
tags | Array of string tags for filtering in the dashboard |
type | "transactional" (default) or "marketing" |
Code examples
import { SmailClient } from "@smail/smail-js";
const smail = new SmailClient({ apiKey: process.env.SMAIL_API_KEY! });
const { email } = await smail.emails.send({
from: "noreply@yourdomain.com",
to: ["user@example.com"],
subject: "Your order has shipped",
html: "<p>Your order #1234 is on its way!</p>",
text: "Your order #1234 is on its way!",
tags: ["transactional", "order-shipped"],
});email, err := client.Emails.Send(ctx, smail.SendEmailRequest{
From: "noreply@yourdomain.com",
To: []string{"user@example.com"},
Subject: "Your order has shipped",
HTML: "<p>Your order #1234 is on its way!</p>",
Text: "Your order #1234 is on its way!",
Tags: []string{"transactional", "order-shipped"},
})Email status
After sending, the returned EmailSend object includes a status field. Possible values:
| Status | Meaning |
|---|---|
queued | Email accepted and queued for delivery |
sent | Successfully handed off to the mail server |
failed | Delivery failed |
Related
- Batch sending — send up to 1,000 emails in one API call
- Send Email reference — full endpoint documentation