Skip to content

CLI Flags & Environment Variables

Configuration is resolved in this precedence order: CLI flags > environment variables > TOML file > defaults.

Reference

CLI FlagEnvironment VariableDefaultDescription
--bindRUSTMAIL_BIND127.0.0.1IP address to bind SMTP and HTTP listeners to. Use 0.0.0.0 for Docker or remote access.
--smtp-portRUSTMAIL_SMTP_PORT1025SMTP listener port
--http-portRUSTMAIL_HTTP_PORT8025HTTP and WebSocket port
--db-pathRUSTMAIL_DB_PATH./rustmail.dbPath to the SQLite database file
--retentionRUSTMAIL_RETENTION0Auto-delete messages after N hours. 0 = keep forever.
--max-messagesRUSTMAIL_MAX_MESSAGES0Maximum messages to retain. Oldest are purged when exceeded. 0 = unlimited.
--max-message-sizeRUSTMAIL_MAX_MESSAGE_SIZE10485760Maximum accepted message size in bytes (default: 10 MB).
--ephemeralRUSTMAIL_EPHEMERALfalseUse in-memory SQLite. No data is written to disk.
--webhook-urlRUSTMAIL_WEBHOOK_URLHTTP endpoint to POST to on every new message.
--log-levelRUSTMAIL_LOG_LEVELinfoLog verbosity: trace, debug, info, warn, error.
--release-hostRUSTMAIL_RELEASE_HOSTAllowed SMTP target for email release in host:port format (e.g. smtp.example.com:587). Release is disabled unless set.
--configPath to an optional TOML configuration file.

Examples

sh
# Bind to all interfaces on custom ports
rustmail serve --bind 0.0.0.0 --smtp-port 2525 --http-port 9025

# Keep only the last 24 hours of email, max 1000 messages
rustmail serve --retention 24 --max-messages 1000

# Enable webhook notifications
rustmail serve --webhook-url https://hooks.example.com/email

# Allow releasing emails to a specific SMTP server
rustmail serve --release-host smtp.mailgun.org:587

Released under the MIT / Apache 2.0 License.