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
- import { Agental } from "agental-sdk";
- const agental = new Agental();
- const sandbox = await agental.sandboxes.get("sbx_2a9a47e50daec64a");
- const message = await sandbox.email.get("eml_9c41d0a7b2e65f38");
Answer200 OK · EmailMessage
- {
- "id": string,
- "sandboxId": string,
- "direction": "received" | "sent",
- "from": string | null,
- "to": string,
- "subject": string | null,
- "sizeBytes": integer,
- "attachments": [{
- "filename": string | null,
- "contentType": string,
- "sizeBytes": integer,
- }],
- "checks": {
- "spf": string | null,
- "dkim": string | null,
- "dmarc": string | null,
- },
- … 9 more
- }
The message.
Path
idrequiredstring | e.g. "sbx_0123456789abcdef" |
messageIdrequiredstring | e.g. "eml_9c41d0a7b2e65f38" |
Headers
AuthorizationrequiredBearer key | An API key that may make this call. |
Returns
200 The message.
EmailMessage18 fields
idstring
sandboxIdstring
directionreceivedsent
fromstringnull
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.tostring
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.subjectstringnull
sizeBytesinteger
The size of the message as it was transmitted, attachments and all.
attachmentsobject[]3 fields
What is attached, by name and size.
More
Their contents are in the raw message. None of it is scanned for anything.filenamestringnull
contentTypestring
sizeBytesinteger
checksobject3 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.spfstringnull
dkimstringnull
dmarcstringnull
spamScorenumbernull
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.sentByProgramboolean
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.createdAtstring
stateacceptedhanded_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.stateDetailstringnull
What a server said, where the message was refused or given up.
More
Null otherwise.messageIdHeaderstringnull
The message's own Message-ID header, which its sender wrote.
More
Two messages can carry the same one.headersobject[]2 fields
Every header, in the order they stand in the message.
More
Names are in lower case.namestring
valuestring
textstringnull
The message as plain text.
More
Null when it has none.htmlstringnull
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.