> For the complete documentation index, see [llms.txt](https://docs.mailtrap.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mailtrap.io/email-api-smtp/email-templates/debugging.md).

# 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

{% @arcade/embed flowId="9uF1XI537kgKMP1RyZxw" url="<https://app.arcade.software/share/9uF1XI537kgKMP1RyZxw>" %}

{% stepper %}
{% step %}
Navigate to Templates in the menu on the left.
{% endstep %}

{% step %}
Click the template you want to call using the API.
{% endstep %}

{% step %}
Open the Integration tab.
{% endstep %}

{% step %}
Toggle the switch to Email Testing.
{% endstep %}

{% step %}
And click Integrate.
{% endstep %}

{% step %}
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.
{% endstep %}

{% step %}
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.
{% endstep %}

{% step %}
Finally, check the sandbox you specified in the script.

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

For more details, [open the API docs](https://docs.mailtrap.io/developers) and go to [Sandbox API](https://docs.mailtrap.io/developers/email-sandbox/send-test-emails) → Test Emails → Send email (including templates). Under Body, click the dropdown menu, and choose `EmailFromTemplate`.
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mailtrap.io/email-api-smtp/email-templates/debugging.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
