Sending Mail
POST /api/accounts/{id}/send delivers a message over SMTP and appends a copy
to the account’s Sent mailbox.
Request
| Field | Description |
|---|---|
to, cc, bcc |
Arrays of plain email address strings; at least one recipient in total is required |
subject |
Subject line |
text |
Plain-text body |
html |
Optional HTML alternative |
inReplyTo |
Optional Message-ID of the message being replied to |
attachments |
Optional array of files, see below |
Recipients are strings ("ops@example.com"), not address objects. Provide
text, or html (or both); Pigeon always sends a plain-text part, adding the
HTML version as an alternative when present.
Each attachment is an object:
| Field | Description |
|---|---|
filename |
Required file name |
contentType |
Optional MIME type; inferred from the file extension when omitted |
content |
File bytes, standard base64 |
The whole request body is limited to 36 MB (attachments count base64-encoded).
Decoded attachments are additionally capped at 25 MB total per message;
exceeding either limit returns 400 before any SMTP connection is opened.
Most mail providers also reject messages beyond roughly 25 MB at delivery
time, in which case the result is a 502.
Response
| Field | Description |
|---|---|
messageId |
Generated Message-ID of the sent mail |
appended |
Whether a copy was appended to the Sent mailbox via IMAP |
warning |
Present when sending succeeded but archiving failed |
The copy goes to sentMailbox, updated automatically to the server’s \Sent
mailbox when one exists. If the append fails, the send still succeeds and the
result carries a warning instead of an error.
Errors
| Status | Meaning |
|---|---|
400 |
Invalid request body: malformed JSON, an attachment without filename, content that is not valid base64, or decoded attachments totalling more than 25 MB |
404 |
Account not found |
502 |
SMTP delivery failed, or addresses/configuration were rejected |
502 covers connection and authentication failures as well as invalid
recipient addresses — Pigeon could not hand the message to the mail server.
Check the error string; it includes the SMTP host and the cause.
Notes
- Delivery is synchronous; the request returns after the SMTP conversation finishes (30-second timeout).
- The SMTP client enforces TLS:
tlsmode uses implicit TLS (SMTPS),starttlsupgrades the plain connection, andnonestill attempts STARTTLS but allows plain text. - SMTP authentication uses
PLAIN. Accounts with an empty username skip auth (useful for local relays). - Sent mail is not written to the local message cache directly; sync the Sent mailbox to list it through the API.