Expand description
SMTP protocol implementation for RusMES
This crate provides a full-featured, RFC 5321-compliant SMTP server implementation built on Tokio for asynchronous I/O.
§Features
- RFC 5321 Compliance: Complete SMTP protocol including HELO/EHLO, MAIL FROM, RCPT TO, DATA, QUIT, RSET, NOOP, and VRFY.
- STARTTLS (RFC 3207): Opportunistic TLS upgrade for secure transport.
- AUTH (RFC 4954): Multiple SASL mechanisms:
- PLAIN (RFC 4616)
- LOGIN
- CRAM-MD5 (RFC 2195)
- SCRAM-SHA-256 (RFC 5802 / RFC 7677)
- PIPELINING (RFC 2920): Client-side pipelining support.
- DSN (RFC 3461): Delivery Status Notification extensions.
- CHUNKING / BDAT (RFC 3030): Binary data transfer without dot-stuffing.
- SIZE (RFC 1870): Message size declaration.
- 8BITMIME (RFC 6152): 8-bit MIME content transfer.
- SMTPUTF8 (RFC 6531): Unicode email addresses.
- Submission (RFC 4409 / RFC 6409): MSA mode on port 587.
§Modules
auth: SASL authentication mechanism implementations.bdat: BDAT/CHUNKING extension state machine (RFC 3030).command: SMTP command types and parameters.dsn: Delivery Status Notification parameter parsing (RFC 3461).parser: Nom-based SMTP command parser.response: SMTP response code formatting.server: Async TCP listener and connection acceptor.session: Per-connection state machine and command dispatcher.submission: Mail Submission Agent (MSA) server variant.
§Quick Start
use std::sync::Arc;
use rusmes_smtp::{SmtpConfig, SmtpServer};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let config = SmtpConfig {
hostname: "mail.example.com".to_string(),
max_message_size: 10 * 1024 * 1024, // 10 MiB
require_auth: false,
enable_starttls: false,
..Default::default()
};
// Build and run the server (requires auth/storage backends)
// let server = SmtpServer::new(config, auth_backend, storage_backend);
// server.listen("0.0.0.0:25").await?;
Ok(())
}Re-exports§
pub use bdat::BdatCommand;pub use bdat::BdatError;pub use bdat::BdatState;pub use command::MailParam;pub use command::SmtpCommand;pub use dsn::DsnError;pub use dsn::DsnMailParams;pub use dsn::DsnNotify;pub use dsn::DsnRcptParams;pub use dsn::DsnRet;pub use parser::parse_command;pub use response::SmtpResponse;pub use server::SmtpServer;pub use session::SmtpConfig;pub use session::SmtpSession;pub use session::SmtpSessionHandler;pub use session::SmtpState;pub use submission::SubmissionConfig;pub use submission::SubmissionServer;
Modules§
- auth
- SMTP authentication mechanisms
- bdat
- SMTP CHUNKING/BDAT Extension - RFC 3030
- command
- SMTP command types
- dsn
- SMTP DSN (Delivery Status Notification) Extension - RFC 3461
- parser
- SMTP command parser using nom
- response
- SMTP response types and codes
- server
- SMTP server implementation
- session
- SMTP session state machine and handler
- submission
- SMTP Submission Server (RFC 6409) - Port 587
Functions§
- is_
ip_ in_ networks - Check if an IP address is in any of the given CIDR networks