Get a message
GET
/messages/{id}Returns one message with its attachments and, for mail you sent, how the send went.
Needs the permissionmessages:read
This is where you find out a send failed: status goes from queued to sending to sent, or ends at failed with lastError holding what the receiving server said. To be told rather than poll, subscribe a webhook to message.sent and message.failed.
sending means the send began and how it ended isn’t known yet. It isn’t counted as sent, because a message that has been sending for an hour needs looking at.
Path parameters
idstringrequired- The message. A draft keeps its id when it’s sent, so a draft’s id works here too.
Returns
idstring- The message.
threadIdstring- The conversation it’s in.
subjectstring- Its subject.
fromobject- The sender, as
addressandname. tolist of strings- The recipients.
bodyHtmlstring- Sanitised, but still written by the sender: show it in a sandboxed iframe.
bodyTextis the plain version. sentAtstring or null- When it was sent or arrived. Null for a draft.
scheduledAtstring or null- When a scheduled send will go.
statusstring or null- For mail written in DMU Mail:
draft,queued,sending,sentorfailed. Null for mail that arrived. lastErrorstring or null- Why the last attempt to send it failed.
attachmentslist- Its files, each with
id,filename,mimeTypeandsizein bytes. See Download an attachment.
Errors
401invalid_key- The key is wrong, expired or revoked. With no Authorization header at all, the code is
missing_credentials. 403missing_scope- The key doesn’t have
messages:read. TheX-Required-Scopeheader names what’s missing. 404not_found- There’s no such message, or the key’s owner can’t see it.
429rate_limited- More than 120 requests a minute from this key. Wait for
Retry-Afterseconds.