Skip to content
Mail Queue & Retries
step 1/5

Reading — step 1 of 5

Read

~1 min readConversation & Auth

Mail Queue & Retries

When a sender hands a message to an MTA, delivery may not happen immediately. The MTA queues it.

Queue lifecycle:

  1. Message accepted with 250 → written to queue (filesystem files in Postfix; database in others).
  2. Queue manager picks it up; resolves recipient's MX records.
  3. Connects to recipient's MTA; transfers message.
  4. Success → remove from queue.
  5. Temporary failure (4xx) → retry later (exponential backoff: 5min, 15min, 1h, 4h, ...).
  6. Permanent failure (5xx) → bounce (return to sender with DSN).
  7. Time-out (default 5 days) → bounce.
incoming/
  <message-id>.envelope (recipients, sender, options)
  <message-id>.message  (headers + body)
deferred/
  <retry queue>
bounced/
  <DSN messages>

Retry policy:

  • Standard: 5 days max retention.
  • Exponential backoff: ~doubling delay.
  • Per-recipient: a message to 10 recipients with 2 failed: queue retries those 2 only.

DNS lookup:

  • MX records: example.com. 86400 IN MX 10 mail.example.com.
  • Lower priority = preferred. Try lowest first; on failure, try next.
  • A/AAAA records for the MX hostname.
  • Caching to avoid hammering DNS.

Concurrency:

  • Many messages in queue → many parallel connections.
  • Limit per destination IP/domain to avoid being rate-limited by recipient.

Failure handling:

  • 421 (service not available) → defer.
  • 4xx (temporary) → retry.
  • 5xx (permanent) → bounce.
  • Connection refused / timeout → defer.

Postfix has separate queues: incoming, active (currently delivering), deferred (waiting retry), corrupt, hold.

Hold queue: admin can pause messages (e.g., for review) and release later.

Discussion

Ask a question, share an insight, or help someone who’s stuck.

Sign in to post a comment or reply.

Loading…