Process receiving attachments
List a received email’s attachments and download each one from its download_url.
A common reason to receive email is to process attachments — airplane tickets, receipts, expenses, and so on. You can inspect attachments in the dashboard, or process them programmatically with the Attachments API.
View and download in the dashboard
- 1Open Emails → Receiving
Go to Emails and select the "Receiving" tab.
- 2Open the message
Open the received email that includes the attachment.
- 3Download
Click the attachment to download it locally.
For automated processing, use the Attachments API instead.
Process attachments programmatically
download_url, which points at the actual bytes. This keeps webhook payloads small for serverless platforms with limited request-body sizes.After the email.received webhook, call the Attachments API for the email_id. It returns a data array of attachments, each with metadata and a download_url you fetch to get the bytes. To retrieve a single attachment, use Retrieve attachment.
download_url is not a public link: fetch it with the same Authorization: Bearer header as every other API call. It does not expire. Attachments whose bytes were not stored have downloadable: false and no download_url — skip those rather than retrying them.import { Mailblastr } from 'mailblastr';
const mb = new Mailblastr('mb_xxxxxxxxx');
const { data, error } = await mb.emails.receiving.listAttachments('56761188-7520-42d8-8898-ff6fc54ce618');
console.log({ data, error });Attachment fields
idstringoptionalThe attachment id, unique within the received email.
filenamestringoptionalThe attachment file name (e.g. invoice.pdf).
content_typestringoptionalMIME type of the attachment (e.g. image/png).
content_dispositionstringoptionalattachment or inline (inline parts are typically embedded images).
content_idstringoptionalThe MIME Content-ID for an inline part, used to reference it from the HTML body.
downloadablebooleanoptionalWhether the file bytes were stored and can be downloaded. false means no download_url is returned.
download_urlstringoptionalURL to download the raw bytes. Requires your API key — send the same Authorization: Bearer header. Omitted when downloadable is false.
Once you have processed the attachments, you may want to forward the email to another address.