Mailtrap Node.js integration
Mailtrap can be integrated with Node.js apps for testing and/or sending purposes with SDK, SMTP, and RESTful API. Choose the one that suits your needs.
Email API/SMTP for Node.js
SDK integration
To integrate Mailtrap into your Node.js project, you can use the official SDK, which gives you access to both Transactional and Bulk Streams, and Templates. You can install it either via yarn or npm.
SMTP integration
To integrate SMTP with your Node.js app, navigate to the Integration tab under Sending Domains and copy/paste the ready-made code snippet or credentials.
Note that you’ll have to use Nodemailer, as Node.js doesn’t have built-in support for SMTP sending.
Read more about SMTP integration here.
RESTful API integration
To integrate Mailtrap using RESTful API, use the sample configuration among Code samples under the API section.
API integration can be used with any Node.js framework or library that supports HTTP requests. For more details, refer to the API documentation.
Read more about API integration here.
Email Testing for Node.js
SDK integration
You can integrate Mailtrap with your Node.js project using the official SDK. Some of the examples can be found here.
SMTP integration
Within the Email Testing menu, navigate to the Inbox and find your SMTP credentials and code snippets. Then, simply copy-paste them into your Nodemailer configuration, as Node.js doesn’t have built-in support for SMTP sending.
Read more about Email Testing SMTP integration here.
RESTful API integration
To use Email Testing API, simply copy/paste the API endpoint and API Token into the configuration file of a Node.js framework or library that supports HTTP requests.
For more details, refer to the API documentation.