/qmail/db/drafts/update

POST

Update an existing email draft with partial changes.

POST /api/qmail/db/drafts/update

Description

The /qmail/db/drafts/update endpoint allows you to update an existing email draft. You only need to send the fields you want to update - all other fields will remain unchanged.

Query Parameters

Parameter Type Required Description
email_id string Yes 32-character hexadecimal identifier of the draft to update.

Request Body (JSON)

Send a JSON payload with only the fields you want to update. All fields are optional.

Field Type Description
to string Recipient email address.
cc string CC recipient email addresses (comma-separated).
bcc string BCC recipient email addresses (comma-separated).
subject string The draft subject.
subsubject string The draft sub-subject.
body string The draft message body.

Example Request Body

{
  "subject": "Updated Draft Subject",
  "body": "This is the updated draft body."
}

Response

Returns a JSON object confirming the update.

Response Properties

success boolean
Whether the update succeeded.
message string
A brief status message.

Try It Out

Examples

JavaScript

const API_BASE = 'http://localhost:8080/api';
const emailId = 'a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6';

async function updateDraft(emailId, data) {
    const response = await fetch(`${API_BASE}/qmail/db/drafts/update?email_id=${emailId}`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(data)
    });
    return await response.json();
}

cURL

curl -X POST "http://localhost:8080/api/qmail/db/drafts/update?email_id=a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6" \
     -H "Content-Type: application/json" \
     -d '{"subject": "New Subject"}'