Skip to content

Tuning Exim retry rules for stubborn destinations

How to adjust Exim retry intervals on a cPanel server so legitimate mail to slow or temperamental destinations actually arrives, without flooding receivers that return 4xx codes intentionally.

The default Exim retry schedule is generic. It works fine for typical destinations and badly for the awkward ones — corporate Exchange that greylists for six hours, a partner who throttles to 10 messages per minute, or a destination whose MX returns 4xx during their evening backups. Without tuning, mail to those hosts either bounces too quickly or stays in queue past the customer’s tolerance. The retry config is the lever.

What’s happening

Exim’s retry rules live in /etc/exim.conf.local and /etc/exim.conf.localopts on cPanel hosts. They specify how long Exim waits before retrying a deferred message and when it gives up. The default is something like 15-minute intervals for the first two hours, then hourly retries up to the bounce window (typically 5 days). When a remote MX returns 421 or 451, Exim defers and retries on the schedule. When the schedule is wrong for the destination’s actual rhythm, mail gets stuck behind the retry cadence.

How to verify

Inspect the active retry config:

exim -bP retry

Then look at the deferred queue for a specific destination:

exim -bp | grep example.com

For each frozen or deferred message, inspect its retry record:

exim -Mvl <message-id>

The retry record shows the last attempt time, the failure reason from the remote, and the next scheduled attempt.

The fix

  1. Identify the pattern in the remote’s failures. Pull the exim_mainlog entries for the destination. Distinguish between transient (4xx) defers, hard (5xx) bounces, and timeouts. Each calls for different retry behavior.

  2. Set a destination-specific retry rule in /etc/exim.conf.local. Example for a slow corporate Exchange:

    exchange-partner.example.com    *    F,2h,15m; G,16h,1h,1.5; F,5d,6h

    This retries every 15 minutes for 2 hours, then hourly (with exponential backoff) for 16 hours, then every 6 hours for 5 days.

  3. For greylisting hosts, push the first retry out to 30 or 60 minutes. Greylisting expects you to retry but not aggressively — hitting it every 5 minutes gets you on the wrong list.

  4. For throttled partners, coordinate with their ops team on a sending rate and configure smtp_accept_max_per_host and queue_run_max in cPanel’s Exim configuration to respect it.

  5. Document each custom retry rule with the destination, the reason, and the date — these decisions are easy to forget and confuse later.

When several cPanel servers handle outbound mail for the same business and the retry profiles need to stay in sync, Stack Harbor maintains them under environment management.