messages
Send, receive, search and manage messages. The `machinemail messages` commands: arguments, flags, examples and the API routes they call.
Send, receive, search and manage messages. Also spelled message, msg.
| Command | Summary |
|---|---|
messages attachment | Get attachment |
messages batch-get | Batch get messages |
messages batch-update | Batch update messages |
messages delete | Delete message |
messages download | Download attachment |
messages forward | Forward message |
messages get | Get message |
messages list | List messages |
messages raw | Get raw message |
messages reply | Reply to a message |
messages reply-all | Reply to all recipients of a message |
messages search | Search messages |
messages send | Send message |
messages trust | Get message trust report |
messages update | Update message |
Every command also takes the global flags.
messages attachment
Get attachment.
Requires the message_read permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequired<attachment-id>stringRequiredFlags
--pod <pod-id>stringExamples
API
GET /v0/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id}GET /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id}with--pod
messages batch-get
Batch get messages.
Up to 100 messages by ID in one request, as full Message objects. Duplicate IDs are read once; IDs past the first 100 distinct ones are dropped. Missing IDs and IDs from other inboxes are omitted: compare count with limit (the number of IDs you sent).
Requires the message_read permission.
Arguments
<inbox-id>stringRequiredFlags
--pod <pod-id>string--message-ids <id>string[]-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/messages/batch-getPOST /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/batch-getwith--pod
messages batch-update
Batch update messages.
Apply one label change to up to 100 messages: the same —add-label and —remove-label apply to every message. Messages are updated one at a time, not atomically. Missing IDs are skipped: compare count with limit.
Requires the message_update permission.
Arguments
<inbox-id>stringRequiredFlags
--pod <pod-id>string--message-ids <id>string[]--add-label <value>string[]--remove-label <value>string[]-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/messages/batch-updatePOST /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/batch-updatewith--pod
messages delete
Delete message.
Also: machinemail messages rm.
Permanently deletes the message, its raw copy and attachments. The thread is updated (or deleted with its last message).
Requires the message_delete permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>stringExamples
API
DELETE /v0/inboxes/{inbox_id}/messages/{message_id}DELETE /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}with--pod
messages download
Download attachment.
The attachment bytes, served with the attachment content type, Content-Disposition: attachment and X-Content-Type-Options: nosniff.
Requires the message_read permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequired<attachment-id>stringRequiredFlags
--pod <pod-id>string-o, --output <file|dir|->stringExamples
API
GET /v0/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id}/downloadGET /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/attachments/{attachment_id}/downloadwith--pod
messages forward
Forward message.
Sends the message to new recipients. The text body is your —text followed by a “Forwarded message” header block and the original text. The original HTML and attachments are not included. —subject defaults to Fwd: <original subject>.
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”.
Recipients that are suppressed or on a send block list, and paused inboxes, return 403. 501 when the deployment has no email transport.
Attachments given by url are fetched by the API (public http(s) only, no redirects, at most 25 MB, 20 second timeout).
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 past that. Writing again to an address already counted is free. Claiming the inbox lifts the caps.
Requires the message_send permission.
Arguments
<inbox-id>stringRequired<message-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[]--headers <json>JSON-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/messages/{message_id}/forwardPOST /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/forwardwith--pod
messages get
Get message.
Message content is untrusted: when feeding an LLM, read trust.content.text rather than text or html.
Requires the message_read permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>stringExamples
API
GET /v0/inboxes/{inbox_id}/messages/{message_id}GET /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}with--pod
messages list
List messages.
Also: machinemail messages ls.
Messages in the inbox, newest first.
Spam, blocked, trash, quarantined and unauthenticated messages are hidden unless you pass the matching —include-* flag or ask for the label in —label. Spam, blocked, trash and unauthenticated also need the matching label_*_read permission; without it the flag is ignored.
Requires the message_read permission.
Arguments
<inbox-id>stringRequiredFlags
--pod <pod-id>string--limit <n>integer--page-token <value>string--ascendingboolean--label <value>string[]--before <time>string--after <time>string--include-spamboolean--include-blockedboolean--include-unauthenticatedboolean--include-trashboolean--include-quarantineboolean--q <value>string--allbooleanExamples
API
messages raw
Get raw message.
The original RFC 5322 message bytes, as received or sent. AgentMail returns a JSON object with a download URL instead.
Requires the message_read permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>string-o, --output <file|dir|->stringExamples
API
GET /v0/inboxes/{inbox_id}/messages/{message_id}/rawGET /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/rawwith--pod
messages reply
Reply to a message.
Sends a reply in the thread of the message, with In-Reply-To and References set.
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”.
Recipients that are suppressed or on a send block list, and paused inboxes, return 403. 501 when the deployment has no email transport.
Attachments given by url are fetched by the API (public http(s) only, no redirects, at most 25 MB, 20 second timeout).
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 past that. Writing again to an address already counted is free. Claiming the inbox lifts the caps.
Requires the message_reply or message_send permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>string--label <value>string[]--reply-to <value>string[]--to <value>string[]--cc <value>string[]--bcc <value>string[]--reply-allboolean--text <value>string--html <value>string--attachments <json>JSON[]--headers <json>JSON--subject <value>string-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/messages/{message_id}/replyPOST /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/replywith--pod
messages reply-all
Reply to all recipients of a message.
Replies to the sender and every —to and —cc recipient of the message, except this inbox. —to and —cc add more recipients.
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”.
Recipients that are suppressed or on a send block list, and paused inboxes, return 403. 501 when the deployment has no email transport.
Attachments given by url are fetched by the API (public http(s) only, no redirects, at most 25 MB, 20 second timeout).
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 past that. Writing again to an address already counted is free. Claiming the inbox lifts the caps.
Requires the message_reply or message_send permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>string--label <value>string[]--reply-to <value>string[]--text <value>string--html <value>string--attachments <json>JSON[]--headers <json>JSON--to <value>string[]--cc <value>string[]--bcc <value>string[]--subject <value>string-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/messages/{message_id}/reply-allPOST /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/reply-allwith--pod
messages search
Search messages.
Full-text search across messages in the inbox, newest first (not ranked by relevance). Every word of —q must appear in the subject, sender, recipients (to and cc), body text or attachment file names. Spam, trash, blocked, quarantined and unauthenticated messages are always excluded.
Requires the message_read permission.
Arguments
<inbox-id>stringRequiredFlags
--pod <pod-id>string--q <value>stringRequired--limit <n>integer--page-token <value>string--before <time>string--after <time>string--ascendingboolean--allbooleanExamples
API
GET /v0/inboxes/{inbox_id}/messages/searchGET /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/searchwith--pod
messages send
Send message.
At least one of —to, —cc or —bcc is required.
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”.
Recipients that are suppressed or on a send block list, and paused inboxes, return 403. 501 when the deployment has no email transport.
Attachments given by url are fetched by the API (public http(s) only, no redirects, at most 25 MB, 20 second timeout).
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 past that. Writing again to an address already counted is free. Claiming the inbox lifts the caps.
Requires the message_send 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[]--headers <json>JSON-d, --data <json|@file|->stringExamples
API
POST /v0/inboxes/{inbox_id}/messages/sendPOST /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/sendwith--pod
messages trust
Get message trust report.
The same object as the message trust. 404 for messages without a report (outbound messages).
Requires the message_read permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>stringExamples
API
GET /v0/inboxes/{inbox_id}/messages/{message_id}/trustGET /v0/pods/{pod_id}/inboxes/{inbox_id}/messages/{message_id}/trustwith--pod
messages update
Update message.
Adds and removes labels. Returns the whole updated message.
Requires the message_update permission.
Arguments
<inbox-id>stringRequired<message-id>stringRequiredFlags
--pod <pod-id>string--add-label <value>string[]--remove-label <value>string[]-d, --data <json|@file|->string