Mailsis
Simple (yet efficient) SMTP and IMAP server.
Mailsis has been written for educational purposes and shouldn't be taken too seriously. Use it at your own risk!
Description
Built on top of the powerful Rust Programming Language, Mailsis provides a safe and efficient implementation of the classic SMTP and IMAP protocols.
Features
- Simple and efficient SMTP server
- Powerful IMAP server
- Authentication with SASL
- Mailbox storage, with support for multiple users
- File-system based, allowing for easy integration with existing systems
SMTP Server
Run the SMTP server from the workspace root:
Configuration is loaded from config.toml by default. To point to a different config file, set the MAILSIS_CONFIG environment variable before launching.
By default, the server listens on 127.0.0.1:2525. You can override the bind address with HOST and PORT environment variables.
Authentication uses passwords/example.txt, and smtp.auth_required is false by default. Set it to true in the config to require credentials.
Redis Routing
Mailsis SMTP can route incoming emails to a Redis queue instead of (or in addition to) local file storage. This requires the redis cargo feature and a running Redis instance.
Build with the redis feature:
Start a Redis server (e.g. via Docker):
Configure config.toml to define a Redis handler and routing rules:
[]
= "file_storage"
= "mailbox"
= true
[]
= "redis"
= "redis://127.0.0.1:6379"
= "incoming_emails"
[]
= "local"
# Route all emails for example.com to Redis
[[]]
= "example.com"
= "redis_queue"
Run the SMTP server:
Send an email to a routed address and verify it lands in Redis:
# Or, if Redis is running in Docker:
Each message is pushed as a JSON object with message_id, from, to, subject, and body fields. See config.example.toml for the full set of routing options (per-address, per-domain, and wildcard domain rules).
IMAP Server
Run the IMAP server from the workspace root:
By default, the IMAP server listens on 127.0.0.1:1430. You can override the bind address with HOST and PORT environment variables.
Authentication uses passwords/example.txt and messages are read from mailbox/.
Examples
Note: Start the SMTP/IMAP servers before running the example clients. The example credentials in
passwords/example.txtincludesender@localhost:passwordandrecipient@localhost:password.
SMTP Python client (sends a test email with an attachment):
SMTP Rust clients:
The smtp_client example validates TLS using certs/ca.cert.pem. The smtp_raw example can optionally take a file path to send as an attachment.
IMAP Python client (reads the latest email from INBOX):
License
Mailsis is currently licensed under the Apache License, Version 2.0.