Nodemailer to a local inbox, no real email sent
Point a Nodemailer SMTP transport at Buggregator: host 127.0.0.1, port 1025, secure: false. Every message your Node.js app sends shows up in the Buggregator UI with the HTML preview and attachments, and no real email is sent.
Steps
1. Start Buggregator
Install the binary and run it. It is one file with no dependencies. The SMTP server starts on port 1025, the web UI on port 8000.
curl -fsSL https://raw.githubusercontent.com/buggregator/server/master/scripts/install.sh | sh
buggregatorIf ~/.local/bin is not in your PATH, run ~/.local/bin/buggregator. Prefer containers? Use Docker or Docker Compose, as shown on Getting Started.
2. Create the transport
Use this transport in development. No authentication is needed and there is no TLS to configure.
const transporter = nodemailer.createTransport({
host: '127.0.0.1',
port: 1025,
secure: false,
});If your app runs in Docker Compose, replace 127.0.0.1 with the Buggregator service name, for example buggregator.
3. Send a message as usual
Your code that sends mail through transporter stays the same. Trigger an email from your app: a sign-up, a reset link, a report.
4. Open the inbox
Open http://127.0.0.1:8000. Each message shows the rendered HTML with a desktop/mobile switcher, the plain text version, From, To, CC, BCC and Reply-To, the attachments and the raw MIME source.
Why it works
Buggregator includes a fake SMTP server. Nodemailer talks to it like to any mail server, but Buggregator stores the email and shows it in the UI instead of delivering it. Any app that can send email over SMTP works the same way, so your Node, PHP, Python and Ruby apps can share one inbox.
Related tips
- Mail
Catch dev email in docker-compose with one service
Add Buggregator as a service in docker-compose.yml and set your app's mail host to its service name. Every email lands in the UI on port 8000.
- Mail
Laravel mail to a local inbox, three .env lines
Set MAIL_MAILER, MAIL_HOST and MAIL_PORT in .env and every Laravel email lands in Buggregator with HTML preview and attachments. Nothing is delivered.
- Mail
Django emails in a local inbox, not the console
Use Django's SMTP email backend with host 127.0.0.1 and port 1025. Every email lands in Buggregator with HTML, headers and attachments.
- Mail
Rails mail to a local inbox shared by all your apps
Point Action Mailer's SMTP settings at 127.0.0.1:1025. Rails emails land in Buggregator, in the same inbox as your Laravel and Node apps.
Checked on with Buggregator v2.8.0