EmailMessage type
An e-mail as it was sent. It is rendered once, when it is sent, and never again.
Who may read it
- Requires the
email.readpermission (otherwiseFORBIDDEN_ROLEnaming it). - Requires every permission the message's content needed when it was sent: for example
invoice.readfor an invoice's data or document,price.readfor amounts,partner.readfor a customer's name, address or e-mail,shipment.readfor a shipment's data andorder.readfor an order's data or document. - Requires the read permission of each kind of record the message is linked to.
- Requires every record the message is linked to (the resource, an invoice's orders, a
shipment's order, an attachment's invoice or order) to be in your API key's scope. An order,
also a shipment's or an invoice's, counts as in your API key's scope only with
partner.read, in the partner scope, and while its customer is not erased. - A message linked to nothing is read by an API key without a scope, or by the API key that sent it.
- A message your API key may not read is
NOT_FOUND, and a list leaves it out.
Fields
id
The message's MAX id.
status
Where the message is on its way out.
senderId
The MAX id of the sender the message went through.
fromAddress
String!
The From address.
fromName
String!
The From display name.
replyTo
String
The Reply-To address. Null when the sender has none.
to
[String!]
The recipients. Null only in the sendEmail result for an API key that may not read the
message, and so are cc, bcc, subject, htmlBody and textBody. No error comes with these
nulls.
Priced as 5 addresses, however many it holds (to, cc and bcc hold at most 50 together).
Costs 5 points.
cc
[String!]
The copy recipients.
Priced as 5 addresses, however many it holds.
Costs 5 points.
bcc
[String!]
The blind copy recipients.
Priced as 5 addresses, however many it holds.
Costs 5 points.
subject
String
The rendered subject.
htmlBody
String
The rendered HTML.
Costs 50 points.
textBody
String
The rendered plain text.
Costs 50 points.
templateCode
String
The code of the template the message was written with. Null when the subject and body were given.
language
String!
The language the message was rendered in.
variantLanguage
String
The language of the template variant the message was written with. Null for the all-languages variant, or when there was no template.
isTest
Boolean!
Whether the message was sent by sendTestEmail.
attempts
Int!
The number of delivery attempts made.
lastError
String
The MAX classification of the last failure and the provider's code, never the provider's text.
DELIVERY_UNCERTAIN means an attempt was cut off after it may have reached the provider, so the
message is not sent again.
providerMessageId
String
The e-mail provider's id for the message. Null until it is sent.
queuedAt
When the message was queued.
sentAt
When the provider accepted the message. Null until it is sent.
failedAt
When delivery failed for good. Null unless it failed.
links
Arguments:
first:Intafter:Stringlast:Intbefore:String
The records the message is linked to.
- A connection, paged with
first/afterorlast/before, at most 250 a page. - Its cursors belong to this message's links and are refused anywhere else.
- Null, with an error at its path, when its page cannot be read, for example because of a
cursor of another parent, or in the
sendEmailresult for an API key that may not read the message (NOT_FOUND). The rest of the response is returned. - A page costs 2 + first (or last) × the cost of one node.
attachments
EmailMessageAttachmentConnection
Arguments:
first:Intafter:Stringlast:Intbefore:String
The message's attachments, by position.
- A connection, paged with
first/afterorlast/before, at most 250 a page. - Its cursors belong to this message's attachments and are refused anywhere else.
- Null, with an error at its path, when its page cannot be read, for example because of a
cursor of another parent, or in the
sendEmailresult for an API key that may not read the message (NOT_FOUND). The rest of the response is returned. - A page costs 2 + first (or last) × the cost of one node.