Docs
Email ›

Get email message

GET/v1/sandboxes/{id}/email/messages/{messageId}

One message: who it is from, what was made of that, its headers and what it says. What it says was written by whoever sent it, which may be anyone. A program that reads it should take it as something said to it, never as something it was told to do.

RequestTypeScript
  1. import { Agental } from "agental-sdk";
  2. const agental = new Agental();
  3. const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
  4. const message = await sandbox.email.get("eml_9c41d0a7b2e65f38");
Answer200 OK · EmailMessage
  1. {
  2. "id": string,
  3. "sandboxId": string,
  4. "direction": "received" | "sent",
  5. "from": string | null,
  6. "to": string,
  7. "subject": string | null,
  8. "sizeBytes": integer,
  9. "attachments": [{
  10. "filename": string | null,
  11. "contentType": string,
  12. "sizeBytes": integer,
  13. }],
  14. "checks": {
  15. "spf": string | null,
  16. "dkim": string | null,
  17. "dmarc": string | null,
  18. },
  19. … 9 more
  20. }

The message.

Path

idrequired
string
e.g. "sbx_0123456789abcdef"
messageIdrequired
string
e.g. "eml_9c41d0a7b2e65f38"

Headers

Authorizationrequired
Bearer key
An API key that may make this call.

Returns

200 The message.

EmailMessage18 fields
id
string
sandboxId
string
direction
receivedsent
from
stringnull
Who the message says it is from: its From header, or where that could not be read, the address the sending server gave.
More Null for a bounce that names nobody.
to
string
The address the message was delivered to.
More This is what it was routed by, and it can differ from the To header a person would see.
subject
stringnull
sizeBytes
integer
The size of the message as it was transmitted, attachments and all.
attachments
object[]3 fields
What is attached, by name and size.
More Their contents are in the raw message. None of it is scanned for anything.
filename
stringnull
contentType
string
sizeBytes
integer
checks
object3 fields
What the mail server made of who sent the message: pass, fail, or none where the sender's domain says nothing.
More Null where it was not checked. A message that passes all three still says nothing of whether its sender means well.
spf
stringnull
dkim
stringnull
dmarc
stringnull
spamScore
numbernull
How much the message looks like spam, where higher is worse.
More Null where it was not scored. Nothing is done about it here: whoever reads the mail decides.
sentByProgram
boolean
True for a bounce, a mailing list's post or an automatic reply: mail no person wrote to this address.
More Answering such mail is how two programs come to write to each other for ever.
createdAt
string
state
acceptedhanded_overdeliveredbouncedexpireduncertainnullnull
Where a sent message has got to.
More accepted: the API took it and charged for it. handed_over: the mail server has it. delivered: the recipient's server took it, which says nothing of inbox or spam folder. bounced: the recipient's server refused it. expired: it could not be delivered within a day. uncertain: whether the mail server took it is not known, and it is not sent again by itself. Null for a message that was received.
stateDetail
stringnull
What a server said, where the message was refused or given up.
More Null otherwise.
messageIdHeader
stringnull
The message's own Message-ID header, which its sender wrote.
More Two messages can carry the same one.
headers
object[]2 fields
Every header, in the order they stand in the message.
More Names are in lower case.
name
string
value
string
text
stringnull
The message as plain text.
More Null when it has none.
html
stringnull
The message as HTML, exactly as it was sent and not made safe to show.
More Null when it has none.

Errors and other answers

404 Not found.

Every error answers { "error": { "code", "message" } }; a key without the action a call needs answers 403 key_action_forbidden, naming it.