Skip to main content

Sending email

POST /sending/messages sends one message from your service. Authenticate with your key as X-API-Key. The body carries the recipients, a content object and, optionally, attachments. Three addresses decide what happens to the message after it leaves you: to, cc and bcc hold the recipients. Supply at least one address across the three, and no more than 10,000 in total per request.

Put your own address in from

content.from is optional. A matching content.from selects an active hosted mailbox or connected Gmail mailbox. Otherwise the first eligible mailbox is selected; domain keys restrict selection to that exact domain. If no mailbox is available in scope, the platform sender is used. Explicit display names are retained. Reply-To defaults to the effective sender unless content.replyTo is supplied. An eligible sender is an active hosted mailbox or a connected Gmail mailbox with sending permission. A registration email or verified domain alone is not a mailbox. Selection is case insensitive. Hosted mailboxes are ordered by default domain, creation time, then ID; connected Gmail follows them. For a Business or Enterprise domain-specific x-api-key, only mailboxes on that exact domain are eligible. An omitted or unrelated from selects the first mailbox in scope. With no eligible mailbox, the platform notification address is used, including for domain keys. Domain-specific keys require an active or trialing Business or Enterprise subscription for creation, regeneration and authentication. Purchased credits alone do not unlock them. Use the secret as x-api-key; it only authorizes message sending and attachment upload, not account, domain, mailbox, tracking or key management.

Where replies go

content.replyTo overrides the reply address. Without it, replies go to the effective sender selected by the API. Set it to an inbox you monitor.

Where bounces go

envelopeSender (also accepted as envelope_sender) remains accepted for compatibility. The API aligns the actual SMTP envelope sender with the selected mailbox rather than using caller input. Gmail uses the connected address; verified-domain sending uses the selected mailbox. Managed relay routes may use their configured bounce address, and platform fallback uses the platform address. Recipients do not see the envelope sender in their inbox. Use content.replyTo to choose where customer replies are delivered. The value must be a bare email address; a display name is rejected (422 on the JSON endpoint, 400 on the multipart endpoint).

Request fields

At least one of textBody and htmlBody must contain non-whitespace text; otherwise the request fails with 400. The API does not generate a plain-text alternative for you — send both when you care about text-only clients. Field names are accepted in camelCase and snake_case for textBody, htmlBody, replyTo and envelopeSender. attachments[].fileName is camelCase only.

Retries and idempotency

Send an Idempotency-Key header (up to 255 printable ASCII characters) with a retryable request. Repeating the same key with the same body returns the original receipt instead of sending twice. Reusing a key with a different body returns 409. The key is scoped to your account, and the same header works on the multipart endpoint.

What the API adds to your message

Accounts without an active paid subscription or purchased credits get a “Powered by WazobiaMail” footer appended to the text and HTML bodies. Paid accounts’ bodies are sent exactly as written.

Responses

422 is the usual failure for sender and recipient problems. Request-wide rules — no recipients, too many recipients, an invalid address in a list — are reported under the key __all__ because they do not belong to a single field:
An invalid sender format looks like this:
The receipt contains only public fields:
200 means accepted, not delivered. Keep trackingId and follow delivery with tracking. See Errors for the full response contract and API responses and privacy for the fields that are intentionally omitted.

Examples

Send normal text without HTML

Use textBody and leave out htmlBody. Newlines are preserved. Tags such as <b> remain literal text.

Offer both plain text and HTML

Provide both bodies in the same content object so the receiving email client can choose its preferred format. Write equivalent content in each version.
To include PDFs, images or other files, use the attachment examples rather than adding local paths to this JSON payload. The same endpoint and request structure appear in PHP, Go, Rust, Python, C# and Java in integration examples.

Pre-send spam and deliverability check

Plan requirement: The spam and deliverability check API (POST /sending/spam-check) is available exclusively on Business and Enterprise plans (including custom tiers) with an active or trialing subscription, as well as platform administrators. Free, Starter, and Pay-as-you-go accounts receive 403 Forbidden.
Before sending an email campaign or critical transaction, you can evaluate your draft against WazobiaMail’s built-in SpamAssassin-style content and deliverability engine. For the exact score bands, the difference between score and deliverabilityScore, and a decision table for green/yellow/red results, see Spam and deliverability scores. Authenticate with your X-API-Key or Bearer token and call POST /sending/spam-check:

Request fields

Response contract

The response caters to both automated developer tooling and non-technical content creators. The top-level message string includes the overall deliverability summary, while data provides detailed rule findings and plain-English recommendations:
  • score: Cumulative penalty points from triggered rules. Lower is better.
  • threshold: The cut-off for isSpam (currently 5.0). Read it from the response rather than hard-coding it.
  • isSpam: true when score >= threshold. Trust this boolean for automated decisions.
  • deliverabilityScore: The inverse health score (0–100, higher is better).
  • badgeColor: green below 2.0, yellow from 2.0 to just below the threshold, and red at or above the threshold.
Full interpretation guide: Spam and deliverability scores.
  • rules[].recommendation: Actionable instructions written in plain language so non-technical team members know exactly how to improve inbox placement.

Delivery is not guaranteed

Neither Gmail nor the platform sender guarantees inbox placement. Platform delivery depends on SPF, DKIM, DMARC, sender reputation, and whether recipients want the messages. Acceptance is separate from delivery. Review delivery activity in your account and check an inbox you control before connecting a live signup or checkout flow. Sending is subject to your account plan and configured provider limits.