Skip to main content
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.messages.raw(
  "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);
200 message/rfc822
The raw message. Content-Disposition: attachment; filename="{id}.eml".

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.
GET/v1/messages/{id}/rawscope · read
import { createClient } from "@mailsai/sdk";

const client = createClient(); // reads MAILS_API_KEY

const result = await client.messages.raw(
  "msg_01JZX8K3M9Q4P7VN2YB6RTDC0E",
);
console.log(result);
200 message/rfc822
The raw message. Content-Disposition: attachment; filename="{id}.eml".

Path Parameters

idstringrequired

Sent (msg_…) or received (rcv_…) message id.

Was this page helpful?