drafts
Drafts, and sends scheduled for later. The `machinemail drafts` commands: arguments, flags, examples and the API routes they call.
Drafts, and sends scheduled for later. Also spelled draft.
| Command | Summary |
|---|---|
drafts create | Create draft |
drafts delete | Delete draft |
drafts get | Get draft |
drafts list | List drafts |
drafts send | Send draft |
drafts update | Update draft |
Every command also takes the global flags.
drafts create
Create draft.
With —send-at the draft is scheduled: a background worker sends it at that time (send_status: scheduled). A scheduled send that fails sets send_status: failed and is not retried.
Reply drafts: set —in-reply-to to a message ID in this inbox; recipients are not filled in for you. Forward drafts (forward_of) and reply_all are not supported.
A message can have at most 50 recipients (deployment default; MachineMail staff can change it, and the error message states the cap in force): —to, —cc and —bcc together, each address counted once. An unclaimed sandbox inbox can have at most 5 (deployment default). More is a 400 validation error with param: “to”. The cap is checked when the draft is created or updated, and again when it is sent: a scheduled draft over the cap at send time gets send_status: failed.
Requires the draft_create permission.
Arguments
<inbox-id>stringRequiredFlags
--pod <pod-id>string--label <value>string[]--reply-to <value>string[]--to <value>string[]--cc <value>string[]--bcc <value>string[]--subject <value>string--text <value>string--html <value>string--attachments <json>JSON[]--in-reply-to <value>string--send-at <time>string | null--client-id <id>string-d, --data <json|@file|->stringExamples
API
drafts delete
Delete draft.
Also: machinemail drafts rm.
Requires the draft_delete permission.
Arguments
<inbox-id>stringRequired<draft-id>stringRequiredFlags
--pod <pod-id>stringExamples
API
DELETE /v0/inboxes/{inbox_id}/drafts/{draft_id}DELETE /v0/pods/{pod_id}/inboxes/{inbox_id}/drafts/{draft_id}with--pod
drafts get
Get draft.
Requires the draft_read permission.
Arguments
<draft-id>stringRequiredFlags
--inbox <inbox-id>string--pod <pod-id>stringExamples
API
GET /v0/drafts/{draft_id}GET /v0/inboxes/{inbox_id}/drafts/{draft_id}with--inboxGET /v0/pods/{pod_id}/drafts/{draft_id}with--pod
drafts list
List drafts.
Also: machinemail drafts ls.
Drafts of every inbox in scope, newest first. The labels filter is not supported.
Requires the draft_read permission.
Flags
--inbox <inbox-id>string--pod <pod-id>string--limit <n>integer--page-token <value>string--before <time>string--after <time>string--ascendingboolean--allbooleanExamples
API
GET /v0/draftsGET /v0/inboxes/{inbox_id}/draftswith--inboxGET /v0/pods/{pod_id}/draftswith--pod
drafts send
Send draft.
Sends the draft now and deletes it; a draft.sent and a message.sent event are emitted. The sent message gets the draft labels plus —add-label, minus —remove-label.
Suppressed recipients and recipients on a send block list return 403, a paused inbox 403. A draft already being sent returns 409; 501 when the deployment has no email transport.
A message can have at most 50 recipients (deployment default; MachineMail staff can change it, and the error message states the cap in force): to, cc and bcc together, each address counted once. An unclaimed sandbox inbox can have at most 5 (deployment default). More is a 400 validation error with param: “to”.
An unclaimed sandbox agent can send a limited number of messages to a limited number of different recipients per rolling 24 hours (deployment defaults 10 and 10): 429 with Retry-After.
Requires the draft_send permission.
Arguments
<inbox-id>stringRequired<draft-id>stringRequiredFlags
--pod <pod-id>string--add-label <value>string[]--remove-label <value>string[]-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/drafts/{draft_id}/sendPOST /v0/pods/{pod_id}/inboxes/{inbox_id}/drafts/{draft_id}/sendwith--pod
drafts update
Update draft.
Fields you omit are unchanged; null clears a field. in_reply_to cannot be changed.
A message can have at most 50 recipients (deployment default; MachineMail staff can change it, and the error message states the cap in force): —to, —cc and —bcc together, each address counted once. An unclaimed sandbox inbox can have at most 5 (deployment default). More is a 400 validation error with param: “to”.
Requires the draft_update permission.
Arguments
<inbox-id>stringRequired<draft-id>stringRequiredFlags
--pod <pod-id>string--reply-to <value>string[] | null--to <value>string[] | null--cc <value>string[] | null--bcc <value>string[] | null--subject <value>string | null--text <value>string | null--html <value>string | null--add-attachments <json>JSON[]--remove-attachments <value>string[]--add-label <value>string[]--remove-label <value>string[]--send-at <time>string | null-d, --data <json|@file|->string