Skip to content

Messages

A message is stored exactly as it arrived, parsed into parts you can assert on.

Listing and waiting return summaries: id, from, to, subject, receivedAt, sizeBytes, attachmentCount. Fetching by id returns the detail, which adds:

Field Contents
textBody, htmlBody The plain-text and HTML parts. Either may be absent
headersJson Every header, as a JSON object in a string. Each value is an array with one entry per occurrence, so a repeated header (such as Received) has several
cc, bcc, replyTo As sent
envelopeFrom, remoteIp, spfResult Delivery details from the SMTP session
attachments id, filename, contentType, sizeBytes, isInline, contentId, virusScanStatus

Attachments are scanned for viruses on arrival. virusScanStatus reports the outcome per attachment: Pending (not scanned yet), Clean, Infected, Skipped (the scan was not run) or Error (the scan failed).

GET /v1/mailboxes/{mailboxId}/messages?limit=50&before={messageId}

Newest first. limit is 1 to 200. To page backwards, pass the last message’s id as before.

Most tests need a link or a code from the body. Prefer the plain-text part when there is one: it has no markup to skip over.

const code = message.textBody?.match(/\b\d{6}\b/)?.[0];
const link = message.textBody?.match(/https:\/\/\S+/)?.[0];

If the application only sends HTML, match against htmlBody. Remember that & inside an HTML attribute is written &; decode before following the link.

Messages are deleted after the mailbox’s retention window, attachments included. Read what you need during the test; do not rely on the mailbox as an archive. See Limits and plans.