rusmes-smtp
SMTP protocol implementation for RusMES, targeting RFC 5321 compliance with modern extensions.
Architecture
SmtpServer
|-- accepts TCP connections
|-- spawns SmtpSession per connection
| |-- SmtpState machine
| |-- Command parser (nom-based)
| |-- Response builder
| |-- Authentication (via rusmes-auth)
| '-- Hands off Mail to MailProcessorRouter
'-- TLS support via rustls
Modules
| Module | Description |
|---|---|
server |
SmtpServer - TCP listener, connection dispatch |
session |
SmtpSession - per-connection state machine and command handling |
command |
SmtpCommand enum - all SMTP commands with parsed parameters |
parser |
parse_command() - nom-based SMTP command parser |
response |
SmtpResponse - SMTP reply codes and messages |
SMTP Commands
| Command | Status | Description |
|---|---|---|
| EHLO/HELO | Implemented | Client greeting with capability negotiation |
| MAIL FROM | Implemented | Set envelope sender |
| RCPT TO | Implemented | Add envelope recipient |
| DATA | Implemented | Message body transfer |
| RSET | Implemented | Reset transaction |
| QUIT | Implemented | Close connection |
| STARTTLS | Implemented | TLS upgrade |
| AUTH | Implemented | PLAIN and LOGIN mechanisms |
| NOOP | Implemented | No operation |
| VRFY | Stub | Verify address |
Session States
Initial -> Connected (after greeting)
-> Authenticated (after AUTH or if auth not required)
-> MailTransaction (after MAIL FROM)
-> Data (after DATA, collecting message body)
-> Quit
Configuration
Dependencies
rusmes-proto- mail typesrusmes-core- mail processing routerrusmes-auth- authentication backendnom- command parsingrustls/tokio-rustls- TLStokio- async networking
Tests
Tests cover: command parsing, response formatting, session state transitions, EHLO capability negotiation, and mail address extraction.