/api/qmail/db/drafts/create
GET POSTSave a new draft email. The server generates a fresh 16-byte email_id (returned as 32-char hex) and inserts the row into the local drafts table.
GET http://localhost:8081/api/qmail/db/drafts/create?subject=Quick%20note&body=See%20you%20tomorrow.&to=8189,9001
Description
All draft fields are optional; passing nothing yields a blank draft you can later populate via drafts/update. Body size is capped at 64 KB. Recipients are passed as comma-separated serial numbers.
Body — JSON or form
The handler accepts either a JSON body or form/query parameters. JSON wins when both are present.
Parameters
| Param | Type | Required | Description |
|---|---|---|---|
subject | string | No | Subject line. |
body | string | No | Up to 64 KB. |
to | string (CSV of SN) | No | Primary recipients, e.g. "8189,9001,9002". |
cc | string (CSV of SN) | No | Carbon-copy recipients. |
Response — 201 Created
{
"command": "drafts-create",
"success": true,
"message": "Draft created successfully",
"email_id": "0c4f8e2a91b34d57a76e1d2c3b4a5968",
"id": "0c4f8e2a91b34d57a76e1d2c3b4a5968",
"timestamp": 1714083600
}Errors
| HTTP | Message |
|---|---|
| 500 | Out of memory |
| 500 | Failed to save draft |
Example
# Save a draft (GET — easy browser/devtool testing)
curl "http://localhost:8081/api/qmail/db/drafts/create?subject=Quick%20note&body=See%20you%20tomorrow.&to=8189,9001"
# Save a draft (canonical POST)
curl -X POST "http://localhost:8081/api/qmail/db/drafts/create" \
-d "subject=Quick note" \
-d "body=See you tomorrow." \
-d "to=8189,9001"Related
- /api/qmail/db/drafts/list — List drafts.
- /api/qmail/db/drafts/update — Update an existing draft.