Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
SMTP Server and Web Interface for reading and testing emails during development
MailDev is a simple way to test email sending functionality during development. It acts as a SMTP server that captures emails and displays them in a web interface, allowing developers to view and test emails without sending them to real email addresses.
SMTP Server
MailDev can be used as a SMTP server to capture emails sent from your application. The code sample demonstrates how to start MailDev on port 1025.
const maildev = new MailDev();
maildev.listen(1025);
Web Interface
MailDev provides a web interface to view captured emails. This code snippet shows how to start the web interface on the default port 1080.
maildev.listen(1025, function() {
console.log('MailDev web interface running at http://localhost:1080');
});
Email Retrieval via API
MailDev offers an API to retrieve emails programmatically. The example fetches all emails from the MailDev server using a simple HTTP GET request.
fetch('http://localhost:1080/email')
.then(response => response.json())
.then(emails => console.log(emails));
Nodemailer is a module for Node.js applications to send emails. Unlike MailDev, which is used for capturing and testing emails, Nodemailer is used for sending emails in production environments. It provides various transport methods, including SMTP, and is highly configurable.
MailHog is a similar tool to MailDev, designed to capture and display emails sent by applications. It provides a web interface and API for viewing and managing emails. MailHog is written in Go and can be used across different platforms, offering similar functionalities to MailDev.
SMTP Server is a Node.js module that provides an SMTP server for testing purposes. It allows developers to create custom SMTP servers for capturing emails. While it doesn't provide a web interface like MailDev, it offers more flexibility in terms of server customization.
MailDev is a simple way to test your project's generated emails during development with an easy to use web interface that runs on your machine built on top of Node.js.
$ npm install -g maildev
$ maildev
If you want to use MailDev with Docker, you can use this image on Docker Hub.
maildev [options]
-h, --help output usage information
-V, --version output the version number
-s, --smtp [port] SMTP port to catch emails [1025]
-w, --web [port] Port to run the Web GUI [1080]
--outgoing-host <host> SMTP host for outgoing emails
--outgoing-port <port> SMTP port for outgoing emails
--outgoing-user <user> SMTP user for outgoing emails
--outgoing-pass <pass> SMTP password for outgoing emails
--outgoing-secure Use SMTP SSL for outgoing emails
-o, --open Open the Web GUI after startup
-v, --verbose
MailDev can be used in your Node.js application. For more info view the API docs.
var MailDev = require('maildev');
var maildev = new MailDev();
maildev.on('new', function(email){
// We got a new email!
});
MailDev also has a REST API. For more info view the docs.
Maildev optionally supports selectively relaying email to an outgoing SMTP server. If you configure outgoing email with the --outgoing-xxx options you can click "Relay" on an individual email to relay through MailDev out to a real SMTP service that will really send the email.
Example:
$ maildev --outgoing-host smtp.gmail.com --outgoing-secure --outgoing-user 'you@gmail.com' --outgoing-pass '<pass>'
Configure your application to send emails via port 1025
and open localhost:1080
in your browser.
Nodemailer (v1.0+)
var transport = nodemailer.createTransport({
port: 1025,
ignoreTLS: true,
// other settings...
});
Nodemailer (v0.7)
var transport = nodemailer.createTransport("SMTP", {
port: 1025,
// other settings...
});
Django -- Add EMAIL_PORT = 1025
in your settings file [source]
Rails -- config settings:
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "localhost",
:port => 1025
}
If you're using MailDev and you have a great idea, I'd love to hear it. If you're not using MailDev because it lacks a feature, I'd love to hear that too. Add an issue to the repo here or contact me on twitter.
Any help on MailDev would be awesome. There is plenty of room for improvement. Feel free to create a Pull Request from small to big changes.
To run MailDev during development:
# grunt-cli is needed by grunt; ignore this if already installed
npm install -g grunt-cli
npm install
grunt dev
The grunt dev
task will run the project using nodemon and restart automatically when changes are detected. SASS files will be compiled automatically on save also. To trigger some emails for testing run node test/send.js
in a separate shell. Please run jshint to your lint code before submitting a pull request; run grunt jshint
.
To run the test suite, use Mocha:
$ npm install -g mocha
$ mocha
0.8.1 - Fix temp directory bug introduced in 0.8.0
0.8.0 - Add view email source. Fix running multiple instances.
0.7.0 - Add Docker support
0.6.3 - Add auto-show new email. UI adjustments.
0.6.2 - Fix module entry point. Bug fixes.
0.6.1 - Bug fixes and improvements
0.6.0 - Add relay option to send outgoing emails. Refactor for new API.
0.5.2 - Lock down dependency versions
0.5.1 - Fix menu layout issue in Safari
0.5.0 - Add command line interface. Web UI redesign.
0.4.0 - Add ability to receive and view attachments
0.3.1 - Add Socket.io for immediate email arrival to interface
0.3.0 - Initial open source release
MailDev is built on using great open source projects including Express, AngularJS, Font Awesome and two great projects from Andris Reinman: Simple SMTP and Mailparser. Many thanks to Andris as his projects are the backbone of this app and to MailCatcher for the inspiration.
Additionally, thanks to all the awesome contributors to the project.
MIT
FAQs
SMTP Server and Web Interface for reading and testing emails during development
We found that maildev demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.