Choose the right email protocol
LMTP and Sieve
Place local delivery and server-side filtering after SMTP transport without confusing them with mailbox access.
8 minute lesson
LMTP resembles SMTP but is designed for final delivery where a server can report a separate result for each recipient after receiving the content. It is often used between a mail server and a local mailbox system.
Sieve is a small server-side language for filtering messages. Rules can file, redirect, reject, or discard mail without depending on a desktop client staying online.
LMTP moves a message into its final delivery system. Sieve decides what to do with it. Neither is a reading protocol.
LMTP changes the result after message data. SMTP returns one transaction result, while LMTP returns one result for each accepted recipient:
C: LHLO mx.example
C: MAIL FROM:<[email protected]>
C: RCPT TO:<[email protected]>
C: RCPT TO:<[email protected]>
C: DATA
S: 354 Send message
C: ...message...
C: .
S: 250 2.1.5 bob delivered
S: 452 4.2.2 full mailbox temporarily over quota
That per-recipient result fits a final-delivery hop where mailbox outcomes are already known. LMTP is commonly used on a trusted internal connection or local socket, not as the public Internet relay protocol.
A Sieve rule works on message metadata and supported tests:
require ["fileinto"];
if header :contains "subject" "Invoice" {
fileinto "Finance";
}
Filtering occurs server-side, so every client sees the result. Rules should have a safe default and avoid loops when redirecting mail.
Give the LMTP transcript one permanent recipient failure. Then write a Sieve rule that files alerts without discarding unmatched messages.
Lesson completed