Local SMTP+IMAP email server for dev/test environments.
Wraps GreenMail — a lightweight, in-memory mail server that runs as a Java process managed by an OTP GenServer.
What it does
- Full SMTP+IMAP server running locally
- Per-address mailboxes — emails to
alice@example.comland in that IMAP inbox - Auth disabled — any username/password auto-provisions an account
- In-memory only — emails vanish on restart
- Managed by OTP — starts/stops with your app, no orphans
Setup
Add to your supervision tree (dev only):
# application.ex children = if Mix.env() == :dev do [{GreenMail.Server, []}] else [] endPoint your SMTP/IMAP config at localhost:3025 / localhost:3143
Emails stay local. Test the full loop.
API
GreenMail.status() # => {:ok, %{smtp_port: 3025, imap_port: 3143, ...}}
GreenMail.stop() # Stop server, release ports
GreenMail.start() # Restart after manual stop
GreenMail.restart() # Flush all mailboxes (restart)
GreenMail.running?() # => true/false
Summary
Functions
API port (8080)
Message count for an email address
IMAP port (3143)
List messages for an email address via REST API
Purge inbox for an email address
SMTP port (3025)
Functions
API port (8080)
Message count for an email address
IMAP port (3143)
List messages for an email address via REST API
Purge inbox for an email address
SMTP port (3025)