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.
Templates in navigation menu
2
Click the template you want to call using the API.
Select template from list
3
Open the Integration tab.
Open Integration tab
4
With Email API/SMTP toggled on, click Integrate under Transactional Stream or Bulk Stream.
Choose stream type and click Integrate
5
Copy the necessary credentials such as Host, API Token, and Template UUID.
Transactional Stream API credentials
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.