Use your existing Nodemailer transport
You do not need an SMTPBox SDK to capture email. Set your Nodemailer transport to the inbox credential and the sandbox SMTP hostname.
const transport = nodemailer.createTransport({
host: 'smtp.smtpbox.dev',
port: 587,
secure: false,
requireTLS: true,
auth: {
user: process.env.SMTPBOX_SMTP_USER,
pass: process.env.SMTPBOX_SMTP_PASSWORD,
},
});On port 587, secure: false means TLS starts after connecting. requireTLS: true requires the STARTTLS upgrade. Port 465 instead uses secure: true. The complete Node.js setup guide includes installation and a sendable example.
Check a real message
Send a text and HTML body to a synthetic recipient such as qa@example.test. Confirm the subject and sender in the inbox, then inspect links and attachments. The recipient does not need to own a mailbox because authenticated sandbox mail is captured in your selected inbox.
Connect email to your test suite
Generate a unique recipient for each test, trigger your application action and use the REST wait endpoint to retrieve the matching message. This works with Node test runners and browser-driven flows such as Playwright.
See email testing in CI for an example that waits for message processing and checks a link against a trusted application origin.
Diagnose connection failures
transport.verify() checks connection and authentication; it does not send or validate an email. If verification fails, check the TLS mode, outbound port access and inbox credentials. If sending succeeds but no body appears immediately, allow message processing to finish.
Manage credentials across environments
Read SMTP credentials from your server environment or CI secrets. Never put an SMTP password or API key into browser JavaScript. Use separate inboxes for development and staging so manual work and automated suites do not mix their results.
Start with a free inbox
Free includes 2,500 captured emails per month and 7-day retention. Unlimited is £14.99 per month with 30-day retention, subject to fair use.
Create your SMTPBox account Compare plans
