eSMS AfricaeSMS Africa
eSMS Mail

Sending Emails

Send emails via the eSMS Mail REST API.

Before sending emails, you must create a sender address on a verified domain. The from email in every request must match an active sender address you own.

Send a single email

curl -X POST https://send.esmsafrica.io/v1/emails/ \
  -H "Authorization: Bearer esms_k_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {"email": "hello@yourdomain.com", "name": "Your App"},
    "to": [{"email": "user@example.com", "name": "John Doe"}],
    "subject": "Welcome to our platform",
    "html": "<h1>Welcome!</h1><p>Thanks for signing up.</p>",
    "text": "Welcome! Thanks for signing up.",
    "tags": ["welcome", "onboarding"]
  }'

Request body

FieldTypeRequiredDescription
fromobjectYesSender email and name. Domain must be verified.
toarrayYesArray of recipient objects with email and optional name.
ccarrayNoCarbon copy recipients.
bccarrayNoBlind carbon copy recipients.
subjectstringYesEmail subject line.
htmlstringNoHTML body. At least one of html or text required.
textstringNoPlain text body.
reply_toobjectNoReply-to address with email and optional name.
headersobjectNoCustom email headers.
tagsarrayNoTags for categorization and filtering.
send_atstringNoISO 8601 datetime for scheduled sending (Starter plan and above).

Response

The send endpoint returns HTTP 202 Accepted.

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "queued",
  "message_id": "<abc123@send.esmsafrica.io>",
  "rejection_reason": null
}

The rejection_reason field is null for accepted emails. When an email is rejected (e.g. unverified domain, invalid sender), it contains a string describing the reason.

Email statuses

StatusDescription
queuedEmail accepted and queued for sending
sentEmail handed off to the mail server
deliveredEmail accepted by the recipient's server
bouncedEmail rejected by the recipient's server
scheduledEmail scheduled for future delivery
cancelledScheduled email was cancelled
failedEmail could not be sent (validation error, etc.)

Scheduled sending

Send an email at a future time by including the send_at field with an ISO 8601 datetime:

curl -X POST https://send.esmsafrica.io/v1/emails/ \
  -H "Authorization: Bearer esms_k_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {"email": "hello@yourdomain.com", "name": "Your App"},
    "to": [{"email": "user@example.com"}],
    "subject": "Tomorrow morning briefing",
    "html": "<p>Your daily briefing...</p>",
    "send_at": "2025-01-16T08:00:00Z"
  }'

The email status will be scheduled until the scheduled time, then it moves to queued and sends automatically.

Scheduled sending requires the Starter plan or above. Free plan users receive a 403 error.

List scheduled emails

curl https://send.esmsafrica.io/v1/emails/scheduled \
  -H "Authorization: Bearer esms_k_your_api_key"

Each scheduled email includes a seconds_until_send countdown.

Cancel a scheduled email

curl -X DELETE https://send.esmsafrica.io/v1/emails/scheduled/{email_id} \
  -H "Authorization: Bearer esms_k_your_api_key"

The email status changes to cancelled. Emails that have already been sent cannot be cancelled.

Send now (skip the schedule)

Send a scheduled email immediately instead of waiting for the scheduled time:

curl -X POST https://send.esmsafrica.io/v1/emails/scheduled/{email_id}/send-now \
  -H "Authorization: Bearer esms_k_your_api_key"

The email moves from scheduled to queued and sends right away.

Scheduled email WebSocket events

The WebSocket at wss://send.esmsafrica.io/ws/emails emits these events for scheduled emails:

EventWhenDescription
scheduled_cancelledCancel button or DELETE endpointThe scheduled email was cancelled
scheduled_sentSend-now button or POST send-now endpointThe scheduled email was sent immediately
email_statusScheduler sends it at the scheduled timeStatus changes from scheduledqueuedsentdelivered

List emails

curl "https://send.esmsafrica.io/v1/emails/?page=1&limit=50" \
  -H "Authorization: Bearer esms_k_your_api_key"

Supports filtering by status, tag, date range, and search.

Get email details

curl https://send.esmsafrica.io/v1/emails/{email_id} \
  -H "Authorization: Bearer esms_k_your_api_key"

Returns the full email details including all delivery events (sent, delivered, opened, clicked, bounced).

Get email events

curl https://send.esmsafrica.io/v1/emails/{email_id}/events \
  -H "Authorization: Bearer esms_k_your_api_key"

Real-time updates

eSMS Mail provides a WebSocket endpoint for real-time email status updates:

wss://send.esmsafrica.io/ws/emails

Events include email_status (status changes), email_new (new emails), and forward_new (forwarded emails).

On this page