SMTP was built on the assumption that networks and servers fail, and that failure is often temporary. When a remote server answers with a 4xx code, times out or is unreachable, the sending MTA does not give up. It stores the message in a queue and tries again later, and again after that, until delivery succeeds or a limit is reached. The details of this schedule decide how quickly mail arrives after an outage, how many connections you open against a struggling provider, when senders get warnings and when a message finally bounces. This guide explains how retry schedules work, what common servers do by default, how to tune them for transactional and bulk traffic and how application-level retries should fit on top. It extends managing the mail queue, rate limits and backoff and reading mail logs.
Which failures are retried
| Situation | Retried? | Notes |
|---|---|---|
| 4xx reply from the remote server (for example 421, 450, 451, 452) | Yes | The server said try again later. See 421 errors |
| Connection refused or timed out | Yes | Network or server outage |
| DNS temporary failure | Yes | Resolver or authoritative server problem |
| TLS handshake failure when TLS is required | Depends on policy | Some policies retry, some fail permanently |
| 5xx reply (550, 553, 554 and so on) | No | Permanent failure; the message bounces |
| Domain does not exist (NXDOMAIN) | No | Permanent |
| Greylisting 4xx on first contact | Yes | Expected to pass on a later attempt. See greylisting |
| Mailbox full 4xx | Yes, for a while | May become a bounce at expiry |
How backoff works
Retrying at a constant rapid pace would hammer a failing server and fill your logs. MTAs therefore back off: the interval between attempts grows after each failure, up to a maximum. An illustration of a typical pattern:
| Attempt | Approximate delay since previous try | Cumulative time |
|---|---|---|
| 1 | Immediate | 0 |
| 2 | 5 to 10 minutes | 10 minutes |
| 3 | About 15 minutes | 25 minutes |
| 4 | About 30 minutes | 1 hour |
| 5 | About 1 hour | 2 hours |
| 6 | About 2 to 4 hours | 6 hours |
| Later | Up to the maximum backoff interval (commonly a few hours) | Until the queue lifetime ends |
Exact numbers differ between MTAs and settings; the table shows the shape. Some servers also randomise a little so that thousands of queued messages do not all retry at the same second. A newly queued message is typically tried again within minutes, while a message that has been failing for two days is tried only every few hours.
Postfix parameters
# /etc/postfix/main.cf
minimal_backoff_time = 300s # first retry interval
maximal_backoff_time = 4000s # cap on retry interval
maximal_queue_lifetime = 5d # give up and bounce after this long
bounce_queue_lifetime = 5d # same limit for bounce messages
queue_run_delay = 300s # how often the queue manager scans deferred mail
delay_warning_time = 4h # send the sender a "still queued" notice (0 = off)
smtp_connect_timeout = 30s
smtp_helo_timeout = 300sEach setting has a clear role. maximal_queue_lifetime sets the deadline after which a deferred message bounces; five days is a conservative default that survives long weekends and multi-day provider incidents. delay_warning_time makes Postfix send the original sender a warning that delivery is delayed, which is useful for human senders and noise for automated ones, so it is often disabled on application relays. Remember that bounces and warnings use the null sender; see the null sender. Other MTAs use equivalent options: Exim has retry rules by domain and error type, Sendmail uses queue run intervals and Timeout.queuereturn, and managed relays expose a retry window in their settings or documentation.
Choosing values
| Kind of mail | Suggested approach | Reason |
|---|---|---|
| Password resets, one-time codes | Short lifetime (for example 1 to 4 hours), then fail fast and tell the application | A code that arrives next day is useless |
| Order confirmations, receipts | Moderate (for example 1 to 2 days) | Still valuable later, but the customer expects speed |
| Newsletters and campaigns | Hours to 1 day for time-bound offers; longer for evergreen content | Avoid delivering last week's sale next week |
| Alerts and monitoring | Short lifetime plus another channel | A stale alert misleads |
| Internal business mail | Standard (several days) | Resilience matters more than speed |
| Mail to a destination with a known long outage | Hold the queue for that domain, do not hammer it | Manual control saves resources |
If you shorten the lifetime for time-sensitive mail, make sure the application learns the outcome: use webhooks or log events to notify your system when a message expires so that it can resend through another channel. See delivery events.
Retries at different layers
- Application to relay (submission). If the relay does not accept the message, because of a timeout or a 4xx, the application must retry with backoff and, where possible, an idempotency key so that a retry cannot send twice. See idempotency and retries.
- Relay to recipient (delivery). The MTA handles this with the schedule described here. The application should not resubmit a message that was accepted.
- Recipient provider internals. After acceptance, the receiving provider may delay or filter; those retries are invisible to you.
- Webhook delivery to your endpoint. Your platform retries event callbacks separately. See webhook reliability.
A common error is double retrying: the application times out waiting for a response, resubmits, and the recipient receives the message twice because the first submission had actually been accepted. Combine timeouts with idempotency keys or message identifiers and check the relay's record before resending.
Reading retry behaviour in logs
Each attempt produces a log line with status=deferred and the remote reason. The sequence of timestamps for one queue ID shows the actual backoff. Look for the pattern of reasons: identical rate-limit text means you should slow your sending to that provider, a connection timeout suggests a network or firewall issue, and a changing set of reasons may point to a flapping remote system. Use the commands in the log guide to count deferrals by reason and domain, and check the queue size over time.
Example timeline of an outage
Suppose a recipient provider has a four-hour incident beginning at 10:00. A message submitted at 10:05 is tried at once and receives a temporary error, so it is queued. It is retried after a few minutes, then after about a quarter of an hour, then about an hour, with each attempt logged as deferred. By 14:30 the provider has recovered and the next scheduled attempt succeeds, so the message is delivered a little over four hours late. Nothing was lost, no one had to resend and the sender received at most a delay warning if one was configured. Now imagine the same incident with a one-hour queue lifetime: the message would bounce at 11:05, the sender would receive a failure notice and the application would have to decide whether to resend. Neither behaviour is wrong; they simply represent different promises about timeliness, which is why the lifetime should match what the mail is for.
Practical guidance
- Keep defaults unless you have a reason; they were chosen for resilience.
- Shorten lifetimes only for streams where late delivery is harmful, and ideally use separate relays or queues for them.
- Do not set the minimum backoff extremely low; fast retries against a rate-limiting provider make things worse.
- Disable delay-warning notices for automated senders so you do not create noise.
- Monitor queue age, not only queue size: a small queue of very old messages is a warning sign.
- Document the schedule in your runbook so support staff can tell customers when a message will finally bounce.
- During provider outages, resist the urge to flush the queue repeatedly; let backoff protect both sides.
The retry schedule is a quiet part of email reliability. Understand how it behaves, tune it for the kinds of mail you send and make sure applications and webhooks cover what the MTA cannot, and temporary trouble will mostly stay invisible to your users.
Send through a managed relay Retries, queues and events handled for you.
References and further reading
Frequently asked questions
How long does an MTA retry a deferred message?
Often about five days by default, with intervals growing from minutes to hours, but it depends on the server settings.
Which errors are retried?
Temporary failures such as 4xx replies, timeouts, connection failures and temporary DNS errors; 5xx replies are permanent and bounce.
Should I shorten the queue lifetime for password resets?
Often yes, to a few hours, as long as the application is told when delivery fails so it can offer another route.
What is a delay warning?
A notice to the sender that a message is still queued, controlled by settings such as delay_warning_time in Postfix.
How do I avoid duplicate sends on retries?
Use idempotency keys or message identifiers and check whether the relay already accepted the message before resubmitting.