Integration

Overview

Once you've created and customized your email template, you can integrate it with your application using the Email API or SMTP. This guide shows you how to get the necessary credentials and code samples to send emails using your templates.

Integration steps

1

Navigate to Templates in the menu on the left.

Mailtrap sidebar menu with Templates menu item highlighted by red arrow
Templates in navigation menu
2

Click the template you want to call using the API.

Templates list showing Newsletter template highlighted by red arrow
Select template from list
3

Open the Integration tab.

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

With Email API/SMTP toggled on, click Integrate under Transactional Stream or Bulk Stream.

Integration page showing Transactional Stream and Bulk Stream options with Integrate buttons highlighted by red arrows
Choose stream type and click Integrate
5

Copy the necessary credentials such as Host, API Token, and Template UUID.

Transactional Stream API credentials box showing Host, API Token, and Template UUID
Transactional Stream API credentials
Bulk Stream API credentials box showing Host, API Token, and Template UUID
Bulk Stream API credentials
6

Alternatively, under Code Samples, choose the desired language and copy the sample configuration already containing the necessary credentials. Mailtrap's official SDKs (Node.js, Python, PHP, and Ruby) also support the templates feature.

7

Paste the code into your project and customize it if needed. Then, run the code to send an email to the email address you indicated in your script.

For more details, open the API docs and go to Email Sending API → Emails → Send email (including template) for transactional stream and Bulk Sending API → Emails → Send email (including template) for bulk stream. Under Body, click the dropdown menu, and choose EmailFromTemplate.

Last updated

Was this helpful?