Skip to content

Retrieve a stored email

Request

Event(s) created from sending an email with Mailgun will contain a storage.key to use to retrieve the email.

Security
basicAuth
Path
domain_namestringrequired

Domain name that was used to send the email

storage_keystringrequired

Storage key from the email's associated events (Example: Accepted/Delivered events storage.key field). Note: Storage keys are available for the duration of your domain's message retention policy.

curl -i -X GET \
  -u '<username>:<password>' \
  'https://api.mailgun.net/v3/domains/{domain_name}/messages/{storage_key}'

Responses

A 200 response

Bodyapplication/json
Content-Transfer-Encodingstringrequired

The content transfer encoding if enabled

Content-Typestringrequired

The content type sent with the message with a possible boundary

Fromstringrequired

The full 'From' email address entry of the email

Message-Idstringrequired

The unique identifier of the message as defined by RFC-2392

Mime-Versionstringrequired

The MIME version of the email

Subjectstringrequired

Subject of the email

Tostringrequired

The full 'To' email address entries

X-Mailgun-Tagstringrequired

The raw tags of the message if provided

senderstringrequired

Just the email address from the provided 'From'' field

recipientsstringrequired

A list of email addresses from the 'To'' field

body-htmlstringrequired

The full HTML body of the full message

body-plainstringrequired

The plain text body of the full message

stripped-htmlstringrequired

Only the body of the email in HTML

stripped-textstringrequired

Only the body of the email in plain text

stripped-signaturestringrequired

The signature stripped from the body

message-headersArray of itemsrequired

The full list of headers of the MIME upon send

X-Mailgun-Template-Namestringrequired

The name of the template if one was used

X-Mailgun-Template-Variablesstringrequired

The variables used in the template if one was used

Response
{ "Content-Transfer-Encoding": "7bit", "Content-Type": "multipart/form-data; boundary=----SomeFormBoundaryABC123", "From": "foo.bar@my-domain.com", "Message-Id": "<xxxxxxxxxxxxx.111111111111111@my-domain.com>", "Mime-Version": "1.0", "Subject": "\"Mailgun is awesome\"", "To": "Cool Bar <cool.barr@cool.com>, bar.baz@gmail.com", "X-Mailgun-Tag": "Earth", "sender": "foo.bar@my-domain.com", "recipients": "cool.barr@cool.com, bar.baz@gmail.com", "body-html": "<html>This is some html</html>", "body-plain": "This is some html", "stripped-html": "<html>This is some html</html>", "stripped-text": "This is some html", "stripped-signature": "the signature block stripped from the plain text message (if found)", "message-headers": [ [], [], [], [], [], [], [], [] ], "X-Mailgun-Template-Name": "my-awesome-template", "X-Mailgun-Template-Variables": "{\"name\":\"Foo\",\"phrase\":\"Bar\"}" }