GET /domains/{mydomain}/messages/{messagekey}

To retrieve an inbound message that has been stored via the store() action, use the URL found in the stored event (which you can find through the Events API, or in the notify webhook set when creating the store action (store(notify="http://mydomain.com/callback")).

These are the parameters of the JSON returned from a GET request to a stored message url.

ParameterTypeDescription
recipientsstringrecipient of the message as reported by MAIL TO during SMTP chat.
senderstringsender of the message as reported by MAIL FROM during SMTP chat. Note: this value may differ from From MIME header.
fromstringsender of the message as reported by From message header, for example “Bob Lee blee@mailgun.net”.
subjectstringsubject string.
body-plainstringtext version of the email. This field is always present. If the incoming message only has HTML body, Mailgun will create a text representation for you.
stripped-textstringtext version of the message without quoted parts and signature block (if found).
stripped-signaturestringthe signature block stripped from the plain text message (if found).
body-htmlstringHTML version of the message, if message was multipart. Note that all parts of the message will be posted, not just text/html. For instance if a message arrives with “foo” part it will be posted as “body-foo”.
stripped-htmlstringHTML version of the message, without quoted parts.
attachmentsstringcontains a json list of metadata objects, one for each attachment, see below.
message-headersstringlist of all MIME headers dumped to a json string (order of headers preserved).
content-id-mapstringJSON-encoded dictionary which maps Content-ID (CID) of each attachment to the corresponding attachment-x parameter. This allows you to map posted attachments to tags like <img src='cid'> in the message body.

Note Do not rely on the body-plain, stripped-text, and stripped-signature fields for HTML sanitization. These fields merely provide content from the text/plain portion of an incoming message. This content may contain unescaped HTML.

The attachments JSON contains the following items.

ParameterTypeDescription
sizeintegerindicates the size of the attachment in bytes.
urlstringcontains the url where the attachment can be found. This does not support DELETE.
namestringthe name of the attachment
content-typestringthe content type of the attachment

These are the parameters when the Accept header is set to message/rfc2822

ParameterTypeDescription
recipientstringrecipient of the message.
senderstringsender of the message as reported by SMTP MAIL FROM.
fromstringsender of the message as reported by From message header, for example “Bob bob@example.com”.
subjectstringsubject string.
body-mimestringfull MIME envelope. You will need a MIME parsing library to process this data.

Servers

Path parameters

Name Type Required Description
mydomain String Yes
messagekey String Yes

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.