Email Platform

Send email from your own domain

HavenPay provisions verified sending domains and email identities on your behalf. Send transactional, OTP, marketing, and notification emails — all from billing@yourdomain.co.ke, not a shared IP.

Multi-gateway routing across Resend, SendGrid, Mailgun, Amazon SES, and SMTP. Full delivery tracking, webhook events, template management, and scheduled broadcasts — all in one platform.

Two paths to a verified sending identity

Choose HavenPay-managed setup (we handle everything) or self-managed (bring your own ESP credentials and go live instantly).

HavenPay-managed (Default)

Submit → Review → DNS → Live

HavenPay configures the ESP, generates DNS records, and activates once verified. Typical turnaround: 1–3 business days.

1
Submit your domain
Provide from_domain, from_name, from_address, reply_to, use_case, and description.
2
Internal review
HavenPay checks domain legitimacy, brand, and use-case policy. ~1 business day.
3
DNS records issued
We configure DKIM/SPF with the upstream ESP and send you exact DNS records to publish.
4
ESP verifies · You go live
Once DNS propagates and the ESP confirms, your identity status moves to Active.
Self-managed (Instant)

Bring your own ESP — activate immediately

Already have a verified domain at Resend, SendGrid, Mailgun, SES, or SMTP? Supply credentials and go live with no admin review.

Extra required fields
{ "self_managed": true, "gateway": "resend", // resend|sendgrid|mailgun|ses|smtp "api_key": "re_xxxx...", // primary credential "esp_domain_id": "abc123-uuid" // domain ID in your ESP }
Supported gateways + credentials
resend
API Key (re_...)
sendgrid
API Key (SG.xxx)
mailgun
API Key · Domain override (optional)
ses
AWS Access Key ID · AWS Secret Access Key · AWS Region
smtp
host:port · Username · Password
Under Review

HavenPay has received your request and is verifying the domain and use-case.

Processing — Setting Up DNS Records

Internally approved. HavenPay is configuring DKIM/SPF with the upstream ESP.

DNS Verification Pending

DNS records issued. Publish them in your domain registrar and wait for propagation.

Active

Verified and live. You can start sending immediately from this identity.

Four email categories, each with a purpose

Every message is tagged with a category. Pricing, routing priority, and tracking behaviour adjust automatically.

KES 0.50

Transactional

Receipts, invoices, password resets — triggered by user action.

Invoices
Receipts
Password resets
Account confirmations
KES 1.00

Marketing

Newsletters, campaigns, promotions — outbound to opted-in subscribers.

Newsletters
Promotions
Campaigns
Announcements
KES 0.30

OTP

One-time passwords and verification codes — lowest latency route.

Login codes
Phone verification
2FA codes
PIN resets
KES 0.50

Notification

System alerts, status updates, service notifications.

Payment alerts
Service status
Downtime notices
System events

Default platform prices in KES. Custom per-merchant pricing available — contact HavenPay to negotiate volume rates.

Three ways to send

All sends route through the same gateway failover pipeline — picked up from priority-ordered active routes.

Single Send

POST /v1/csp/email/send

One HTML/text email to a single recipient. Supports html_body, text_body, category, and identity selection.

recipientsubjecthtml_bodytext_bodycategoryidentity_id

Template Send

POST /v1/csp/email/send-template

Send via gateway-hosted templates. Resend UUIDs, SendGrid d-XXXXXXXX IDs, Mailgun template names.

recipientsubjecttemplate_idtemplate_datacategory

Bulk Broadcast

POST /v1/csp/email/send-bulk

Broadcast to up to 5,000 recipients in one call. Supports both raw body and gateway templates.

recipients[]subjecthtml_body / template_idcategorybatch_id
Bulk send limit: Maximum 5,000 recipients per batch call. Each recipient is sent individually with its own message record, batch_id linkage, and delivery tracking. For larger lists, batch in multiple calls.

Build, preview & send from templates

Store reusable HTML email templates under your account. Render them on the fly with variable substitution, preview before sending, and wire them into scheduled campaigns.

CRUD API
Create, list, update, and delete HTML email templates with named variables via REST.
{{variable}} syntax
Liquid-style {{variable}} tokens in both subject and HTML body are resolved at send time.
Live Preview
POST to /preview with sample variables — get rendered subject + HTML back instantly.
Test Send
Send a fully rendered test email to any address directly from the template API.
Categories
Each template is tagged transactional, marketing, otp, or notification — pricing applied automatically.
Scheduler Integration
CommEvent scheduler resolves and renders templates at fire time with per-event variable substitution.

Full Template API Reference

The complete endpoint reference — CRUD, preview, and test-send — lives in the developer docs. Seven endpoints covering every template operation.

View API docs

Multi-gateway failover routing

HavenPay maintains a priority-ordered list of active email routes. Each send attempt walks the list until one gateway succeeds. Gateway credentials are Fernet-encrypted at rest.

1
Resend
Platform default
2
SendGrid
Fallback #1
3
Mailgun
Fallback #2
4
Amazon SES
Enterprise tier
5
SMTP
Custom relay
6
Mock/Test
Sandbox mode
Automatic failover

Routes are tried in ascending priority order. If a gateway returns an error or throws an exception, HavenPay logs the failure, increments the route's total_failed counter, and moves to the next available route transparently.

Encrypted credentials

Each gateway route stores up to three credentials (API keys, secrets, regions) encrypted with Fernet symmetric encryption using your SECRET_KEY. Credentials are decrypted only at dispatch time and never logged.

Per-route cost tracking

Each gateway route records its cost per category (transactional, marketing, OTP, notification). Every message tracks both cost_to_platform (gateway cost) and charged_to_merchant (your price), enabling margin reporting.

Real-time event webhooks from every gateway

HavenPay receives signed webhook events from Resend, SendGrid, Mailgun, and Amazon SES. Status only advances — it never regresses. Bounces and complaints are always recorded.

Delivered
delivered
Opened
opened
Clicked
clicked
Bounced
bounced
Complained
complained
Sent
sent
Resend/email/webhooks/resend
svix-signature header (whsec_ secret)
SendGrid/email/webhooks/sendgrid
ECDSA X-Twilio-Email-Event-Webhook-Signature
Mailgun/email/webhooks/mailgun
HMAC-SHA256 X-Mailgun-Signature-V2
Amazon SES/email/webhooks/ses
SNS auto-confirm + SNS signature validation

Message Log & Stats API

Query your full message history, filter by status or batch, pull aggregate open/click/bounce stats, and retrieve your current per-category pricing — all documented in the API reference.

View API docs

Automated email broadcasts & campaigns

CommEvent lets you define named events that fire email (and SMS / WhatsApp) on a schedule. Templates are rendered at fire time with variable substitution. Full execution history and audit log included.

One-off Events
Fire once at a specific UTC datetime. Auto-cancels after dispatch.
Recurring Events
Daily, weekly, monthly, or raw 5-field cron expression. End date optional.
Flexible Recipients
Static lists, named segments (all_isp_subscribers, all_rental_tenants), or single address.
Template Variables
Per-event variable JSON resolved and rendered at fire time.
Execution Logs
Every firing writes a CommEventExecution with batch_id, sent/failed counts, and error details.
Audit Trail
Append-only CommScheduleAuditLog tracks every state change: created, paused, fired, cancelled.
Recurrence options
Daily

Fires every day at a specified HH:MM UTC time.

"recurrence_time": "08:00"
Weekly

Fires on a specific day of the week (0=Mon, 6=Sun) at a given time.

"recurrence_day_of_week": 1
Monthly

Fires on a specific day of the month. Clamped to last day if month is short.

"recurrence_day_of_month": 1
Custom cron

Raw 5-field cron expression. No external dependency — scanned in-process.

"recurrence_cron": "0 8 * * 1"
Typical Activation Timeline

1–3 business days to go live

DNS propagation typically takes 24–48 hours. Once the upstream ESP verifies your records, we activate your identity immediately — or use self-managed mode to skip the queue entirely.

1
Internal review
Status: Under Review → Processing
~1 business day
2
DNS records issued
Status: DNS Verification Pending
Same day
3
ESP DNS verification
Status: Active — you can start sending
1–3 days

Start sending from your own domain today

Register your sending identity and be live in days. Self-managed mode activates instantly.