import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.messages.raw(
"msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.get_raw_message(
"msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/messages/msg_01JZX8K3M9Q4P7VN2YB6RTDC0E/raw' \
-H "Authorization: Bearer $MAILS_API_KEY"mails emails raw msg_01JABC --output message.eml
mails emails raw msg_01JABC | less{
"name": "mails_emails_raw",
"arguments": {
"message_id": "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E"
}
}200 message/rfc822
The raw message. Content-Disposition: attachment; filename="{id}.eml".200 The raw message. Content-Disposition: attachment;
filename="{id}.eml".
400 Invalid request — malformed JSON or a field failed
validation. Also feature_not_enabled when this
server has a feature switched off (custom domains
before they are available).
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
404 Resource not found in this workspace, or the agent
a send names is archived (agent_archived).
500 Internal server error.Download raw RFC822 (.eml)
Returns the message as a downloadable
.eml attachment: the exact bytes as received when the raw message was kept (received mail up to 25 MiB), otherwise an RFC822 message rebuilt from the stored fields, with the Message-ID, From, Reply-To, In-Reply-To and References it went out or came in with.import { createClient } from "@mailsai/sdk";
const client = createClient(); // reads MAILS_API_KEY
const result = await client.messages.raw(
"msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);from mailsai import create_client
client = create_client() # reads MAILS_API_KEY
result = client.get_raw_message(
"msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
)
print(result)curl 'https://api.mails.ai/v1/messages/msg_01JZX8K3M9Q4P7VN2YB6RTDC0E/raw' \
-H "Authorization: Bearer $MAILS_API_KEY"mails emails raw msg_01JABC --output message.eml
mails emails raw msg_01JABC | less{
"name": "mails_emails_raw",
"arguments": {
"message_id": "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E"
}
}200 message/rfc822
The raw message. Content-Disposition: attachment; filename="{id}.eml".200 The raw message. Content-Disposition: attachment;
filename="{id}.eml".
400 Invalid request — malformed JSON or a field failed
validation. Also feature_not_enabled when this
server has a feature switched off (custom domains
before they are available).
401 Missing or invalid API key.
403 The API key lacks the required scope
(insufficient_scope), or the token belongs to an
app connected by sign-in and this operation is
closed to connected apps
(connected_app_not_allowed).
404 Resource not found in this workspace, or the agent
a send names is archived (agent_archived).
500 Internal server error.Was this page helpful?