Skip to main content
Email is ideal for rich content delivery, transactional notifications, and messages that need to be referenced later.

When to Use Email

  • Transactional emails: Order confirmations, receipts, shipping updates
  • Account notifications: Password resets, security alerts, welcome emails
  • Rich content: HTML formatting, images, detailed information
  • Asynchronous communication: Messages that don’t require immediate attention
Email operates as a separate channel and does not participate in smart routing. You must explicitly specify channel: "email" or send to an email address.

Sending an Email

const result = await zavu.messages.send({
  to: "user@example.com",
  channel: "email",
  subject: "Your order has shipped",
  text: "Hi John, your order #12345 has shipped and will arrive in 2-3 business days."
});

HTML Emails

Send rich HTML emails by including htmlBody. The text field serves as the plain-text fallback:
const result = await zavu.messages.send({
  to: "user@example.com",
  channel: "email",
  subject: "Welcome to Zavu",
  text: "Welcome to Zavu! We are excited to have you on board.",
  htmlBody: `
    <h1>Welcome to Zavu!</h1>
    <p>We are excited to have you on board.</p>
    <a href="https://dashboard.zavu.dev">Get Started</a>
  `,
  replyTo: "support@yourcompany.com"
});

Request Fields

FieldRequiredDescription
toYesValid email address
channelYesMust be "email"
subjectYesEmail subject line (max 998 chars)
textYesPlain text body
htmlBodyNoHTML version of the email
replyToNoReply-To email address

Channel Detection

If you send to an email address without specifying a channel, Zavu automatically selects email:
const result = await zavu.messages.send({
  to: "user@example.com",
  subject: "Hello",
  text: "This will be sent as email automatically"
});

Setting Up Email

Before sending emails, you need to configure your sender with a verified domain.

1. Add Your Domain

Go to Email Domains in the dashboard and add your domain (e.g., yourcompany.com).

2. Configure DNS

Add the DKIM records provided by Zavu to your DNS:
selector1._domainkey.yourcompany.com  CNAME  selector1.dkim.zavu.dev
selector2._domainkey.yourcompany.com  CNAME  selector2.dkim.zavu.dev
selector3._domainkey.yourcompany.com  CNAME  selector3.dkim.zavu.dev
DNS propagation typically takes a few minutes, but can take up to 48 hours in some cases.

3. Verify Domain

Zavu automatically checks your DNS records every 5 minutes. Once verified, your domain status will change to verified.

4. Assign to Sender

Assign the verified domain to a sender and configure your from address:
  • From address: noreply@yourcompany.com
  • Reply-To address: support@yourcompany.com (optional)

Delivery Status

Check message status by ID:
const result = await zavu.messages.get({ messageId: "msg_abc123" });
console.log("Status:", result.message.status);
StatusDescription
queuedAccepted, pending delivery
sendingBeing sent to recipient
deliveredConfirmed delivered
failedDelivery failed

Common Errors

ErrorDescriptionSolution
subject_requiredMissing subject lineInclude subject field
sender_not_configuredSender lacks email setupConfigure email domain on sender
domain_not_verifiedDomain not verifiedComplete DNS verification
bounceEmail bouncedInvalid or non-existent email address
complaintMarked as spamReview email content and sending practices

Email vs SMS/WhatsApp

FeatureEmailSMS / WhatsApp
Smart RoutingNo - explicit channelYes - auto-selected
Automatic FallbackNoYes
Recipient TypeEmail addressPhone number (E.164)
Rich ContentFull HTML supportLimited (WhatsApp only)
Delivery SpeedMinutesSeconds
Email is a separate channel and does not fall back to SMS/WhatsApp if delivery fails.

Best Practices

  1. Always include plain text - Some email clients only show plain text
  2. Use a verified domain - Improves deliverability and avoids spam filters
  3. Set Reply-To - Make it easy for recipients to respond
  4. Keep subjects clear - Descriptive subjects improve open rates
  5. Test before sending - Preview HTML emails in multiple clients
  6. Respect unsubscribes - Honor opt-out requests promptly

Compliance

Email messaging is regulated. Ensure you comply with CAN-SPAM, GDPR, and other applicable laws.

Requirements

  • Consent: Have permission before sending marketing emails
  • Unsubscribe: Include a working unsubscribe link
  • Sender identification: Clearly identify your business
  • Physical address: Include your business address (for marketing emails)
  • Honest subject lines: Don’t use deceptive subject lines

Example Compliant Email

<h1>Your Order Has Shipped!</h1>
<p>Hi John, your order #12345 has shipped.</p>
<p>Track your package: <a href="https://track.co/abc">View Tracking</a></p>

<hr>
<p style="font-size: 12px; color: #666;">
  YourCompany, Inc. | 123 Main St, San Francisco, CA 94102<br>
  <a href="https://yourcompany.com/unsubscribe">Unsubscribe</a>
</p>