📄️ Overview
Stalwart MTA provides a flexible and robust framework for managing outbound email delivery. Messages sent to both local and external domains are processed through a strategy-driven architecture that allows precise control over how, when, and where each message is delivered. This architecture evaluates delivery strategies dynamically for each recipient, enabling the system to adapt its behavior based on the message context, such as the recipient's domain, the sender’s identity, message type, or assigned priority.
📄️ Strategies
In Stalwart MTA, strategies define the behavior and policies used during the delivery of email messages, whether to local recipients or remote systems. Strategies allow administrators to define flexible, dynamic delivery logic based on runtime conditions, using expressions that are evaluated for each recipient and message. This approach enables fine-grained control over message routing, scheduling, connection parameters, and transport security, adapting to the needs of complex mail environments.
📄️ Queues
Queues are essentially a holding area for outbound messages in an SMTP server. When a message arrives, it is placed in the queue until it can be delivered to its final destination. Stalwart supports an unlimited number of virtual queues, which means that a system administrator can create and configure multiple queues with different settings and behaviors. This allows for a high degree of flexibility and customization in managing incoming messages. For example, different queues can be created for different types of messages, such as messages from high-priority senders or messages with specific content, and these queues can be processed differently, such as by assigning more resources or prioritizing delivery.
📄️ Scheduling
Queue scheduling determine which virtual queue to use, the frequency of delivery attempts, the timing for notifications of delivery issues, and the maximum amount of time a message can stay in the queue before it is considered expired and returned to the sender.
📄️ Routing
Message routing is the process of determining the final destination host to which an email message should be delivered. When a message is processed for delivery, the selected routing strategy defines whether it should be delivered locally, resolved through DNS, or sent through an intermediate relay server.
📄️ Connection
A connection strategy in Stalwart MTA defines how the system establishes SMTP connections to remote servers during message delivery. While routing strategies determine where messages are delivered, connection strategies control how those connections are made. Each connection strategy specifies parameters such as which source IP address to bind to, the hostname to advertise in the EHLO command, and timeout values for various stages of the SMTP session. This level of control is particularly useful in complex environments, such as multi-homed systems, outbound IP rotation setups, or when complying with specific policy or network constraints.
📄️ TLS
Stalwart implements TLS support to ensure secure transmission of emails over the internet. TLS (Transport Layer Security) is essential for protecting data in transit, providing encryption, authentication, and integrity to prevent unauthorized access and tampering of email messages. Stalwart’s TLS configuration is built on rustls, a modern, high-performance TLS library that prioritizes safety and correctness.
📄️ DNS
The DNS resolver is responsible for resolving human-readable domain names into IP addresses and other type of machine-readable records. This is done by sending DNS queries to a DNS server, which then responds with the associated record of the domain name in question.
📄️ Rate Limits
Rate limiting is a mechanism used to control the flow of connections and messages by restricting the number of requests or actions allowed over a specific time period. In Stalwart, rate limiting ensures that email traffic is managed efficiently, preventing resource overuse and protecting the server from abuse, such as spam or denial-of-service (DoS) attacks.
📄️ Quotas
Quotas allows to set limits on the message queue to control its size and total number of messages. Stalwart supports enforcing dynamic quotas on the message queue, which means that it can limit the total size and number of messages waiting to be delivered based on multiple variables. If a queue quota is exceeded, messages will be temporarily rejected with a 4xx SMTP code. This is useful in preventing the server from becoming overwhelmed by too many messages and ensuring that important messages are delivered promptly.