For the complete documentation index, see llms.txt. This page is also available as Markdown.

Messages

Inspect captured emails

Interactions with messages

Show email message

get

Get email message by ID.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns email message with its attributes.

application/json

Email message captured in a Sandbox. Body URLs are often under /api/testing_message_parts/... rather than nested under /api/accounts/.../messages/.... blacklists_report_info may contain only result or the full report. template_variables is set when the message was sent from a template.

idintegerOptional
sandbox_idintegerOptional
subjectstringOptional
sent_atstringOptional
from_emailstringOptional
from_namestringOptional
to_emailstringOptional
to_namestringOptional
email_sizeintegerOptional
is_readbooleanOptional
created_atstringOptional
updated_atstringOptional
template_idintegerOptional
html_body_sizeintegerOptional
text_body_sizeintegerOptional
human_sizestringOptional
html_pathstringOptional
txt_pathstringOptional
raw_pathstringOptional
download_pathstringOptional
html_source_pathstringOptional
get/api/sandboxes/{sandbox_id}/messages/{message_id}
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id} \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "id": 2323,
  "sandbox_id": 17002,
  "subject": "Test email",
  "sent_at": "2022-07-01T19:29:59.295Z",
  "from_email": "john@mailtrap.io",
  "from_name": "John",
  "to_email": "mary@mailtrap.io",
  "to_name": "Mary",
  "email_size": 300,
  "is_read": false,
  "created_at": "2022-07-01T19:29:59.295Z",
  "updated_at": "2022-07-01T19:29:59.295Z",
  "template_id": 0,
  "template_variables": null,
  "html_body_size": 150,
  "text_body_size": 100,
  "human_size": "300 Bytes",
  "html_path": "/api/accounts/16297/sandboxes/17002/messages/2323/body.html",
  "txt_path": "/api/accounts/16297/sandboxes/17002/messages/2323/body.txt",
  "raw_path": "/api/accounts/16297/sandboxes/17002/messages/2323/body.raw",
  "download_path": "/api/accounts/16297/sandboxes/17002/messages/2323/body.eml",
  "html_source_path": "/api/accounts/16297/sandboxes/17002/messages/2323/body.htmlsource",
  "blacklists_report_info": {
    "result": "success",
    "domain": "example.com",
    "ip": "23.215.0.138",
    "report": []
  },
  "smtp_information": {
    "ok": true,
    "data": {
      "mail_from_addr": "john@mailtrap.io",
      "client_ip": "193.62.62.184",
      "rcpt_to_addrs": [
        "mary@mailtrap.io"
      ]
    }
  }
}

Delete message

delete

Delete message from sandbox.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns attributes of the deleted message.

application/json
idintegerOptional
sandbox_idintegerOptional
subjectstringOptional
sent_atstringOptional
from_emailstringOptional
from_namestringOptional
to_emailstringOptional
to_namestringOptional
email_sizeintegerOptional
is_readbooleanOptional
created_atstringOptional
updated_atstringOptional
html_body_sizeintegerOptional
text_body_sizeintegerOptional
human_sizestringOptional
html_pathstringOptional
txt_pathstringOptional
raw_pathstringOptional
download_pathstringOptional
html_source_pathstringOptional
blacklists_report_infobooleanOptional
delete/api/sandboxes/{sandbox_id}/messages/{message_id}
curl -X DELETE https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id} \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "id": 433,
  "sandbox_id": 4338,
  "subject": "Test email",
  "sent_at": "2022-06-02T19:24:10.746Z",
  "from_email": "john@mailtrap.io",
  "from_name": "John",
  "to_email": "mary@mailtrap.io",
  "to_name": "Mary",
  "email_size": 300,
  "is_read": false,
  "created_at": "2022-06-02T19:24:10.747Z",
  "updated_at": "2022-06-02T19:24:10.747Z",
  "html_body_size": 150,
  "text_body_size": 100,
  "human_size": "300 Bytes",
  "html_path": "/api/accounts/3775/sandboxes/4338/messages/433/body.html",
  "txt_path": "/api/accounts/3775/sandboxes/4338/messages/433/body.txt",
  "raw_path": "/api/accounts/3775/sandboxes/4338/messages/433/body.raw",
  "download_path": "/api/accounts/3775/sandboxes/4338/messages/433/body.eml",
  "html_source_path": "/api/accounts/3775/sandboxes/4338/messages/433/body.htmlsource",
  "blacklists_report_info": false,
  "smtp_information": {
    "ok": true,
    "data": {
      "mail_from_addr": "john@mailtrap.io",
      "client_ip": "193.62.62.184"
    }
  }
}

Update message

patch

Update message attributes (right now only the is_read attribute is available for modification).

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Body
Responses
200

Returns attributes of the updated message.

application/json
idintegerOptional
sandbox_idintegerOptional
subjectstringOptional
sent_atstringOptional
from_emailstringOptional
from_namestringOptional
to_emailstringOptional
to_namestringOptional
email_sizeintegerOptional
is_readbooleanOptional
created_atstringOptional
updated_atstringOptional
html_body_sizeintegerOptional
text_body_sizeintegerOptional
human_sizestringOptional
html_pathstringOptional
txt_pathstringOptional
raw_pathstringOptional
download_pathstringOptional
html_source_pathstringOptional
blacklists_report_infobooleanOptional
patch/api/sandboxes/{sandbox_id}/messages/{message_id}
curl -X PATCH https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id} \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"message": {"is_read": "true"}}'
{
  "id": 427,
  "sandbox_id": 4324,
  "subject": "Test email",
  "sent_at": "2022-06-02T19:24:08.941Z",
  "from_email": "john@mailtrap.io",
  "from_name": "John",
  "to_email": "mary@mailtrap.io",
  "to_name": "Mary",
  "email_size": 300,
  "is_read": false,
  "created_at": "2022-06-02T19:24:08.942Z",
  "updated_at": "2022-06-02T19:24:08.942Z",
  "html_body_size": 150,
  "text_body_size": 100,
  "human_size": "300 Bytes",
  "html_path": "/api/accounts/3761/sandboxes/4324/messages/427/body.html",
  "txt_path": "/api/accounts/3761/sandboxes/4324/messages/427/body.txt",
  "raw_path": "/api/accounts/3761/sandboxes/4324/messages/427/body.raw",
  "download_path": "/api/accounts/3761/sandboxes/4324/messages/427/body.eml",
  "html_source_path": "/api/accounts/3761/sandboxes/4324/messages/427/body.htmlsource",
  "blacklists_report_info": false,
  "smtp_information": {
    "ok": true,
    "data": {
      "mail_from_addr": "john@mailtrap.io",
      "client_ip": "193.62.62.184"
    }
  }
}

Get messages

get

Get all messages in the sandbox. The response contains up to 30 messages. Use last_id or page to retrieve more.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
Query parameters
searchstringOptional

Search query string. Matches subject, to_email, and to_name.

Example: welcome
last_idnumber · min: 1Optional

If specified, a page of records before last_id is returned. Overrides page if both are given.

Example: 123
pagenumber · min: 1Optional

Page number for paginated results.

Example: 5
Responses
200

lists messages

application/json

Email message captured in a Sandbox. Body URLs are often under /api/testing_message_parts/... rather than nested under /api/accounts/.../messages/.... blacklists_report_info may contain only result or the full report. template_variables is set when the message was sent from a template.

idintegerOptional
sandbox_idintegerOptional
subjectstringOptional
sent_atstringOptional
from_emailstringOptional
from_namestringOptional
to_emailstringOptional
to_namestringOptional
email_sizeintegerOptional
is_readbooleanOptional
created_atstringOptional
updated_atstringOptional
template_idintegerOptional
html_body_sizeintegerOptional
text_body_sizeintegerOptional
human_sizestringOptional
html_pathstringOptional
txt_pathstringOptional
raw_pathstringOptional
download_pathstringOptional
html_source_pathstringOptional
get/api/sandboxes/{sandbox_id}/messages
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages \
  -H 'Authorization: Bearer YOUR_API_KEY'
[
  {
    "id": 92,
    "sandbox_id": 342,
    "subject": "Test email",
    "sent_at": "2022-08-19T11:34:33.839Z",
    "from_email": "per667son25@feeney.biz",
    "from_name": "Ela Marks",
    "to_email": "per688son26@donnelly.info",
    "to_name": "Edmund Maggio",
    "email_size": 300,
    "is_read": false,
    "created_at": "2022-08-19T11:34:33.841Z",
    "updated_at": "2022-08-19T11:34:33.841Z",
    "template_id": 0,
    "template_variables": null,
    "html_body_size": 150,
    "text_body_size": 100,
    "human_size": "300 Bytes",
    "html_path": "/api/accounts/336/sandboxes/342/messages/92/body.html",
    "txt_path": "/api/accounts/336/sandboxes/342/messages/92/body.txt",
    "raw_path": "/api/accounts/336/sandboxes/342/messages/92/body.raw",
    "download_path": "/api/accounts/336/sandboxes/342/messages/92/body.eml",
    "html_source_path": "/api/accounts/336/sandboxes/342/messages/92/body.htmlsource",
    "blacklists_report_info": {
      "result": "pending"
    },
    "smtp_information": {
      "ok": true,
      "data": {
        "mail_from_addr": "per667son25@feeney.biz",
        "client_ip": "75.180.183.201",
        "rcpt_to_addrs": [
          "per688son26@donnelly.info"
        ]
      }
    }
  }
]

Forward message

post

Forward message to an email address. The email address must be confirmed by the recipient in advance.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Body
emailstringOptionalExample: jack@mailtrap.io
Responses
200

Returns confirmation about forwarding.

application/json
messagestringOptional
post/api/sandboxes/{sandbox_id}/messages/{message_id}/forward
curl -X POST https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/forward \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"email": "recipient@example.com"}'
{
  "message": "Your email message has been successfully forwarded"
}

Get message spam score

get

Get a brief spam report by message ID.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message spam analysis report.

application/json
get/api/sandboxes/{sandbox_id}/messages/{message_id}/spam_report
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/spam_report \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "report": {
    "ResponseCode": 2,
    "ResponseMessage": "Not spam",
    "ResponseVersion": "1.2",
    "Score": 1.2,
    "Spam": false,
    "Threshold": 5,
    "Details": [
      {
        "Pts": 0,
        "RuleName": "HTML_MESSAGE",
        "Description": "BODY: HTML included in message"
      }
    ]
  }
}

Get message HTML analysis

get

Get a brief HTML report by message ID.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message HTML analysis report.

application/json
get/api/sandboxes/{sandbox_id}/messages/{message_id}/analyze
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/analyze \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "report": {
    "status": "success",
    "errors": [
      {
        "error_line": 15,
        "rule_name": "style",
        "email_clients": {
          "desktop": [
            "Notes 6 / 7"
          ],
          "mobile": [
            "Gmail"
          ]
        }
      },
      {
        "error_line": 7,
        "rule_name": "display",
        "email_clients": {
          "desktop": [
            "AOL Desktop",
            "IBM Notes 9",
            "Outlook 2000–03",
            "Outlook 2007–16",
            "Outlook Express",
            "Postbox",
            "Windows 10 Mail",
            "Windows Live Mail"
          ],
          "mobile": [
            "Android 4.2.2 Mail",
            "Android 4.4.4 Mail",
            "BlackBerry",
            "Gmail Android app IMAP",
            "Google Inbox Android app",
            "Windows Phone 8 Mail",
            "Yahoo! Mail Android app",
            "Yahoo! Mail iOS app"
          ],
          "web": [
            "Yahoo! Mail"
          ]
        }
      }
    ]
  }
}

Get text message

get

Get text email body, if it exists.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message body in txt format.

text/plain
stringOptionalExample: 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.
get/api/sandboxes/{sandbox_id}/messages/{message_id}/body.txt
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/body.txt \
  -H 'Authorization: Bearer YOUR_API_KEY'
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.

Get raw message

get

Get raw email body.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns raw message body.

text/plain
stringOptionalExample: 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--
get/api/sandboxes/{sandbox_id}/messages/{message_id}/body.raw
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/body.raw \
  -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--

Get message source

get

Get HTML source of email.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns HTML source of a message.

text/html
stringOptionalExample: <!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>
get/api/sandboxes/{sandbox_id}/messages/{message_id}/body.htmlsource
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/body.htmlsource \
  -H 'Authorization: Bearer YOUR_API_KEY'
<!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>

Get HTML message

get

Get formatted HTML email body. Not applicable for plain text emails.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns message body in html format.

text/html
stringOptionalExample: <!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>
get/api/sandboxes/{sandbox_id}/messages/{message_id}/body.html
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/body.html \
  -H 'Authorization: Bearer YOUR_API_KEY'
<!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>

Get message as .eml

get

Get email message in .eml format.

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
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--
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--

Get mail headers

get

Get mail headers of a message

Authorizations
Api-TokenstringRequired

Pass the API token in the Api-Token

Path parameters
sandbox_idinteger · int64 · min: 1Required

Unique sandbox ID

Example: 4015
message_idinteger · int64 · min: 1Required

Unique message ID

Example: 427
Responses
200

Returns mail headers of the message

application/json
headersobjectOptional

An object containing key/value pairs of header names and value. The key/value pairs must be strings.

get/api/sandboxes/{sandbox_id}/messages/{message_id}/mail_headers
curl -X GET https://mailtrap.io/api/sandboxes/{sandbox_id}/messages/{message_id}/mail_headers \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "headers": {
    "bcc": "john_doe@example.com",
    "cc": "john_doe@example.com",
    "from": "john_doe@example.com",
    "to": "john_doe@example.com",
    "subject": "Your Example Order Confirmation"
  }
}

Last updated

Was this helpful?