API Reference

Download Raw Received Email

GET /emails/receiving/:id/raw — download the original RFC 822 .eml bytes for a received email.

GET/emails/receiving/:id/raw

Downloads the original RFC 822 message bytes for a received email. Unlike most API endpoints, this route does not return a JSON object — the response body is the raw .eml binary. The response carries: - Content-Type: message/rfc822 - Content-Disposition: attachment; filename="<id>.eml" - X-Content-Type-Options: nosniff The SDK method mb.emails.receiving.getRaw(id) returns an `ArrayBuffer` containing the raw bytes. Parse or save it as a binary file — do not treat it as JSON. Not every received email has stored raw bytes; if the original message was not retained, the endpoint returns not_found.

Path parameters
idstringrequired

The id of the received email.

import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.emails.receiving.getRaw('4ef9a417-02e9-4d39-ad75-9611e0fcc33c');
console.log({ data, error });

Response

On success the response body is the raw RFC 822 message bytes (binary, not JSON). Save or stream the body as a .eml file.

HTTP/1.1 200 OK
Content-Type: message/rfc822
Content-Disposition: attachment; filename="4ef9a417-02e9-4d39-ad75-9611e0fcc33c.eml"
X-Content-Type-Options: nosniff

<raw RFC 822 message bytes>

Returns not_found (404) if the received email does not exist for your account, or if no raw message was stored for it. See the error reference.