Messages
A message is stored exactly as it arrived, parsed into parts you can assert on.
Summary and detail
Section titled “Summary and detail”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 JSON. A repeated header (such as Received) is an array |
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.
Listing
Section titled “Listing”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.
Pulling values out of a body
Section titled “Pulling values out of a body”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.
Retention
Section titled “Retention”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.