Connect your app to MailDev
MailDev runs a local SMTP server on port 1025 and a
web inbox on 1080. Point your framework's mail
transport at localhost:1025 — no auth needed in
development — then watch the mail arrive at
http://localhost:1080.
Install & run
npm
npm install -g maildev
maildev
Docker
docker run -p 1080:1080 -p 1025:1025 maildev/maildev
Prefer Compose? See the Docker guide.
Node.js (Nodemailer)
// No auth or TLS needed against MailDev in development
const transport = nodemailer.createTransport({
host: 'localhost',
port: 1025,
})
await transport.sendMail({
from: 'app@example.com',
to: 'user@test.com',
subject: 'Hello from MailDev',
text: 'It works!',
})
Django
In your settings file:
EMAIL_HOST = 'localhost'
EMAIL_PORT = 1025
EMAIL_HOST_USER = ''
EMAIL_HOST_PASSWORD = ''
EMAIL_USE_TLS = False
Ruby on Rails
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'localhost',
port: 1025,
enable_starttls_auto: false
}
Spring Boot
spring.mail.host=localhost
spring.mail.port=1025
spring.mail.properties.mail.smtp.auth=false
spring.mail.properties.mail.smtp.starttls.enable=false
Anything else
MailDev speaks plain SMTP, so any language or framework works the same
way: send to localhost:1025 with authentication and TLS
turned off. It also exposes a full REST API and a programmatic Node
API for driving it from tests.