Debugging with Sandbox

Overview

Before sending your email templates to production, it's important to test them in a safe environment. Mailtrap Email Sandbox allows you to test your templates, preview how they render, and verify that all variables are working correctly.

Debugging steps

1

Navigate to Templates in the menu on the left.

Mailtrap sidebar with Templates menu item highlighted by red arrow
Navigate to Templates
2

Click the template you want to call using the API.

Templates list showing Newsletter template highlighted by red arrow
Select template to debug
3

Open the Integration tab.

Template page showing Details and Integration tabs with Integration tab highlighted by red arrow
Open Integration tab
4

Toggle the switch to Email Testing.

Integration page with Email Testing toggle highlighted by red arrow
Toggle to Email Testing
5

And click Integrate.

Testing Inbox card with Integrate button highlighted by red arrow
Click Integrate for Testing Inbox
6

Select the desired sandbox from the dropdown menu to reveal its credentials. Copy the Host, API Token, Template UUID, and Sandbox ID.

Alternatively, you can also use one of the pre-made Code Samples.

Sandbox integration showing API credentials and code samples with sandbox dropdown
Sandbox credentials and code samples
7

Paste the code into your project and customize it if needed. Then, run the code to send an email to the selected Email Testing sandbox.

8

Finally, check the sandbox you specified in the script.

Email Testing sandbox showing received test email with template content
Test email received in sandbox

The Tech Info tab contains the link to the template you tested and lists all the variables used in the template.

Tech Info tab showing template link and variables used in the email
Tech Info tab with template details

For more details, open the API docs and go to Sandbox API → Test Emails → Send email (including templates). Under Body, click the dropdown menu, and choose EmailFromTemplate.

Last updated

Was this helpful?