Get message as .eml
Get email message in .eml format.
get
Authorizations
Api-TokenstringRequired
Pass the API token in the Api-Token
Path parameters
sandbox_idinteger · int64 · min: 1RequiredExample:
Unique sandbox ID
4015message_idinteger · int64 · min: 1RequiredExample:
Unique message ID
427Responses
200
Returns .eml of the message.
message/rfc822
string · binaryOptionalExample:
From: Magic Elves <from@example.com> To: Mailtrap Inbox <to@example.com> Subject: You are awesome! Content-Type: multipart/alternative; boundary="boundary-string" --boundary-string Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Congrats for sending test email with Mailtrap! Inspect it using the tabs above and learn how this email can be improved. Now send your email using our fake SMTP server and integration of your choice! Good luck! Hope it works. --boundary-string Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline <!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <body style="font-family: sans-serif;"> <div style="display: block; margin: auto; max-width: 600px;" class="main"> <h1 style="font-size: 18px; font-weight: bold; margin-top: 20px"> Congrats for sending test email with Mailtrap! </h1> <p>Inspect it using the tabs you see above and learn how this email can be improved.</p> <img alt="Inspect with Tabs" src="https://assets-examples.mailtrap.io/integration-examples/welcome.png" style="width: 100%;" > <p>Now send your email using our fake SMTP server and integration of your choice!</p> <p>Good luck! Hope it works.</p> </div> <!-- Example of invalid for email html/css, will be detected by Mailtrap: --> <style> .main { background-color: white; } a:hover { border-left-width: 1em; min-height: 2em; } </style> </body> </html> --boundary-string--401
Returns unauthorized error message. Check your credentials.
text/plain
403
Returns forbidden error message. Check your permissions.
text/plain
404
Returns not found error message
application/json
409
Returns conflict error message. .eml body does not exist.
text/plain
get/api/sandboxes/{sandbox_id}/messages/{message_id}/body.eml
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/body.eml \
-H 'Authorization: Bearer YOUR_API_KEY'
From: Magic Elves <from@example.com>
To: Mailtrap Inbox <to@example.com>
Subject: You are awesome!
Content-Type: multipart/alternative; boundary="boundary-string"
--boundary-string
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Congrats for sending test email with Mailtrap!
Inspect it using the tabs above and learn how this email can be improved.
Now send your email using our fake SMTP server and integration of your choice!
Good luck! Hope it works.
--boundary-string
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body style="font-family: sans-serif;">
<div style="display: block; margin: auto; max-width: 600px;" class="main">
<h1 style="font-size: 18px; font-weight: bold; margin-top: 20px">
Congrats for sending test email with Mailtrap!
</h1>
<p>Inspect it using the tabs you see above and learn how this email can be improved.</p>
<img
alt="Inspect with Tabs"
src="https://assets-examples.mailtrap.io/integration-examples/welcome.png"
style="width: 100%;"
>
<p>Now send your email using our fake SMTP server and integration of your choice!</p>
<p>Good luck! Hope it works.</p>
</div>
<!-- Example of invalid for email html/css, will be detected by Mailtrap: -->
<style>
.main { background-color: white; }
a:hover { border-left-width: 1em; min-height: 2em; }
</style>
</body>
</html>
--boundary-string--
Last updated
Was this helpful?

