A next-generation distributed mail server built in Rust, porting Apache JAMES architecture with modern protocol support and AI integration capabilities.
-
Multi-Protocol Support
- β SMTP (RFC 5321) - Full implementation with STARTTLS, AUTH, PIPELINING
- β IMAP (RFC 9051) - Full implementation
- β JMAP (RFC 8620/8621) - Full HTTP/JSON API
- β POP3 (RFC 1939) - Full implementation with STARTTLS, APOP, CAPA
-
Flexible Message Processing
- Mailet-based processing pipeline (inspired by Apache JAMES)
- Configurable matcher-mailet chains
- State-based mail routing
- Support for custom mailets and matchers
-
Multiple Storage Backends
- Filesystem (maildir format)
- PostgreSQL (ready for implementation)
- AmateRS distributed storage (ready for implementation)
-
Enterprise Features
- Authentication backends (LDAP, OAuth, PAM ready)
- Full-text search with Tantivy (ready)
- Prometheus metrics
- Legal archiving integration (Legalis-RS)
- AI-powered mail analysis (OxiFY integration ready)
rusmes/
βββ crates/
β βββ rusmes-proto/ # Core protocol types (Mail, MailAddress, etc.)
β βββ rusmes-core/ # Mailet processing engine (9 mailets, 5 matchers)
β βββ rusmes-storage/ # Storage abstraction + backends (filesystem, postgres)
β βββ rusmes-smtp/ # SMTP server (RFC 5321, STARTTLS, AUTH)
β βββ rusmes-imap/ # IMAP server foundation (RFC 9051)
β βββ rusmes-jmap/ # JMAP server foundation (RFC 8620/8621)
β βββ rusmes-pop3/ # POP3 server (RFC 1939, STARTTLS, APOP)
β βββ rusmes-auth/ # Authentication backends (File, LDAP, SQL, OAuth2, PAM)
β βββ rusmes-search/ # Full-text search (Tantivy)
β βββ rusmes-config/ # Configuration management (TOML/YAML, hot-reload)
β βββ rusmes-metrics/ # Prometheus metrics + OpenTelemetry tracing
β βββ rusmes-cli/ # CLI tool (user, mailbox, queue, backup/restore)
β βββ rusmes-server/ # Main server binary
β βββ rusmes-acme/ # TLS/ACME certificate management
β βββ rusmes-loadtest/ # Load testing utilities
β βββ rusmes-benches/ # Performance benchmarks (criterion)
β βββ rusmes-tests/ # Integration test suite
βββ examples/ # Configuration examples (minimal, full, production)
βββ Dockerfile # Multi-stage Docker build
βββ docker-compose.yml # Full deployment stack
βββ rusmes.service # systemd service file
βββ rusmes.toml # Example configuration
# Build all components
cargo build --release
# Run tests
cargo test
# Build specific binaries
cargo build --bin rusmes-server
cargo build --bin rusmes# Using example configuration
cargo run --bin rusmes-server -- rusmes.toml
# Or with default configuration
cargo run --bin rusmes-serverThe server will start on:
- SMTP:
0.0.0.0:2525 - SMTP+STARTTLS:
0.0.0.0:2587
# Connect with telnet
telnet localhost 2525
# Send a test message
EHLO test.example.com
MAIL FROM:<sender@example.com>
RCPT TO:<recipient@example.com>
DATA
Subject: Test Message
This is a test message.
.
QUIT# Initialize server
cargo run --bin rusmes -- init --domain example.com
# Manage users
cargo run --bin rusmes -- user add user@example.com --password secret
cargo run --bin rusmes -- user list
# Manage mailboxes
cargo run --bin rusmes -- mailbox list user@example.com
cargo run --bin rusmes -- mailbox create user@example.com --name Spam
# View metrics
cargo run --bin rusmes -- metricsConfiguration is loaded from rusmes.toml (TOML format):
domain = "example.com"
postmaster = "postmaster@example.com"
[smtp]
host = "0.0.0.0"
port = 2525
max_message_size = "50MB"
enable_starttls = true
[storage]
backend = "filesystem"
path = "/var/mail/rusmes"
[[processors]]
name = "root"
state = "root"
[[processors.mailets]]
matcher = "RecipientIsLocal"
mailet = "LocalDelivery"See rusmes.toml for a complete example.
# Run all tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific crate tests
cargo test -p rusmes-smtp
cargo test -p rusmes-coreTotal: 1,942 tests passing (49 skipped)
Zero warnings, zero errors
RusMES uses a mailet-based processing pipeline:
- Mail enters the system (via SMTP, JMAP, etc.)
- Router determines which processor to use based on mail state
- Processor executes a chain of matcher-mailet pairs:
- Matcher filters recipients
- Mailet processes matched mail
- Mailets can change mail state, triggering routing to other processors
- Final delivery to local mailboxes or remote servers
v0.1.1 Released: 2026-03-25 π
Phase 1-2: Core Foundation β Complete
- Mail types, storage traits, mailet engine
Phase 3: SMTP Server β Complete
- Full RFC 5321 implementation
- Command parser, session management
- STARTTLS, AUTH support
Phase 4: IMAP Server β Complete
- Session states, command types
- Ready for full protocol implementation
Phase 5: JMAP Server β Complete
- HTTP API structure, JSON types
- Ready for method implementations
Phase 6: Storage Backends β Complete
- β Filesystem backend (maildir)
- β PostgreSQL backend
- β AmateRS distributed backend
Phase 7: Extensions β Complete
- β Standard mailets (LocalDelivery, RemoteDelivery)
- β Standard matchers (RecipientIsLocal, All)
- β SpamAssassin, VirusScan integration
- β OxiFY AI integration
- β Legalis-RS legal archiving
Phase 8: Configuration & CLI β Complete
- TOML configuration loading
- CLI tool with user/mailbox management
Apache-2.0
Contributions welcome! This is a reference implementation of modern mail server architecture in Rust.
- Apache JAMES - Reference implementation
- AmateRS - Distributed storage backend
- OxiFY - AI mail analysis
- Legalis-RS - Legal archiving
- FOP - Document generation
Memory Usage Target: 10-50MB (vs 500MB-2GB for Java-based servers) Performance Target: >50,000 messages/sec throughput
RusMes is developed and maintained by COOLJAPAN OU (Team Kitasan).
If you find RusMes useful, please consider sponsoring the project to support continued development of the Pure Rust ecosystem.
https://github.com/sponsors/cool-japan
Your sponsorship helps us:
- Maintain and improve the COOLJAPAN ecosystem
- Keep the entire ecosystem (OxiBLAS, OxiFFT, SciRS2, etc.) 100% Pure Rust
- Provide long-term support and security updates