In this guide, you’ll learn how to configure it with thePurplebox SMTP service to send transactional emails reliably and securely.
Prerequisites
Before getting started, make sure your project has:- Nodemailer installed
- A thePurplebox SMTP password (API key) stored in your
.envfile - A verified sending domain (recommended for best deliverability)
Install Nodemailer
Optional: Install Nodemailer TypeScript types
If your project uses TypeScript, install the types as well:Set up environment variables
Store your SMTP password securely in a.env file:
.env
Note: The SMTP username is always: thepurplebox
Sending Transactional Emails
Once Nodemailer and your environment variables are set up, you can create atransporter.
This object defines the SMTP connection settings and determines whether you use STARTTLS or SSL.
Using STARTTLS (Port 587)
Setsecure to false and use port 587:
Using SSL (Port 465)
Setsecure to true and use port 465: