Email Commands
Send emails, manage templates, domains, senders, and suppressions from the CLI.
Email Commands
The email command group provides full control over your email infrastructure.
Sending Emails
Send a Single Email
transactional email send \
--from "hello@yourdomain.com" \
--to "recipient@example.com" \
--subject "Hello from Transactional" \
--html "<h1>Hello!</h1><p>This is a test email.</p>"Send Options
| Option | Description |
|---|---|
-f, --from <email> | Sender email (required) |
-t, --to <email> | Recipient email (required) |
-s, --subject <text> | Email subject |
--html <content> | HTML body |
--text <content> | Plain text body |
--template <id> | Template ID |
--template-alias <alias> | Template alias |
--model <json> | Template variables (JSON) |
--cc <emails> | CC recipients (comma-separated) |
--bcc <emails> | BCC recipients (comma-separated) |
--reply-to <email> | Reply-to address |
--tag <tag> | Message tag for tracking |
--stream <id> | Stream ID |
Using Templates
transactional email send \
--from "hello@yourdomain.com" \
--to "user@example.com" \
--template-alias "welcome-email" \
--model '{"name": "John", "company": "Acme"}'Batch Sending
Send multiple emails from a JSON file:
transactional email batch emails.jsonThe JSON file should contain an array of email objects:
[
{
"from": "hello@yourdomain.com",
"to": "user1@example.com",
"subject": "Hello User 1",
"htmlBody": "<p>Content for user 1</p>"
},
{
"from": "hello@yourdomain.com",
"to": "user2@example.com",
"subject": "Hello User 2",
"htmlBody": "<p>Content for user 2</p>"
}
]Use --dry-run to validate without sending:
transactional email batch emails.json --dry-runTemplates
List Templates
transactional email templates listFilter options:
| Option | Description |
|---|---|
--server <id> | Filter by server ID |
--status <status> | Filter by status (DRAFT, ACTIVE, ARCHIVED) |
--limit <n> | Max results (default: 50) |
Get Template Details
transactional email templates get <id>Create Template
transactional email templates create \
--name "Welcome Email" \
--subject "Welcome to {{company}}!" \
--server 1 \
--alias "welcome-email" \
--html "<h1>Welcome, {{name}}!</h1>"Update Template
transactional email templates update <id> \
--subject "New Subject" \
--html "<h1>Updated content</h1>"Delete Template
transactional email templates delete <id>Domains
List Domains
transactional email domains listAdd Domain
transactional email domains add mail.example.comThis returns DNS records you need to configure:
DNS Records to configure:
TXT:
Name: transactional._domainkey.mail.example.com
Value: v=DKIM1; k=rsa; p=MIIBIjANBg...
TXT:
Name: mail.example.com
Value: v=spf1 include:spf.usetransactional.com ~all
Verify Domain
After configuring DNS records, verify the domain:
transactional email domains verify <id>Delete Domain
transactional email domains delete <id>Senders
List Senders
transactional email senders listAdd Sender
transactional email senders add hello@yourdomain.com --name "Support Team"A verification email will be sent to the address.
Delete Sender
transactional email senders delete <id>Suppressions
Suppressions prevent emails from being sent to certain addresses.
List Suppressions
transactional email suppressions listFilter by server:
transactional email suppressions list --server 1Add Suppression
transactional email suppressions add user@example.com \
--server 1 \
--reason MANUAL \
--notes "Customer requested no emails"Suppression reasons:
| Reason | Description |
|---|---|
HARD_BOUNCE | Email address doesn't exist |
SPAM_COMPLAINT | Recipient marked email as spam |
MANUAL | Manually added |
UNSUBSCRIBE | User unsubscribed |
Remove Suppression
transactional email suppressions remove <id>Statistics
Get email statistics for your organization:
transactional email statsOptions:
| Option | Description |
|---|---|
--period <period> | day, week, month (default: week) |
--server <id> | Filter by server ID |
--stream <id> | Filter by stream ID |
Example output:
Email Statistics (week)
Sent 1,234
Delivered 1,220
Bounced 14
Complaints 2
Opened 856
Clicked 234
Rates:
Delivery Rate 98.87%
Open Rate 70.16%
Click Rate 19.26%
Bounce Rate 1.13%
Complaint Rate 0.0016%
On This Page
- Email Commands
- Sending Emails
- Send a Single Email
- Send Options
- Using Templates
- Batch Sending
- Templates
- List Templates
- Get Template Details
- Create Template
- Update Template
- Delete Template
- Domains
- List Domains
- Add Domain
- Verify Domain
- Delete Domain
- Senders
- List Senders
- Add Sender
- Delete Sender
- Suppressions
- List Suppressions
- Add Suppression
- Remove Suppression
- Statistics