Skip to content

Reading the Exim mainlog when delivery looks normal

A guide to interpreting Exim mainlog entries on a cPanel host so you can distinguish accepted-but-deferred from delivered, and trace a single message from accept to bounce.

A customer says their message never arrived. The cPanel server logs show the message was accepted, queued, and the SMTP conversation looks healthy. The receiver claims nothing landed. Until you can read exim_mainlog line by line and tell the difference between “accepted from local user”, “delivered to remote”, and “delivered to local file marked as delivered then expired in queue”, you cannot resolve this conversation in under twenty minutes. The log format pays back the time it takes to learn it.

What’s happening

Exim writes one or more lines per message to /var/log/exim_mainlog. Every line starts with a timestamp and a message ID (16 characters, base62), followed by a flag that says what just happened:

  • <= arrival (received from sender or local user)
  • => delivery to a destination
  • -> additional address for the same message
  • ** delivery failed (bounce)
  • == deferred (will retry)
  • Completed final state — message has left the queue

A “completed” message could have been delivered, bounced, or simply expired in queue. The flag tells you which.

How to verify

Find a specific message in the log:

grep <message-id> /var/log/exim_mainlog

Or trace by sender or recipient:

grep "sender@example.com" /var/log/exim_mainlog | head
exigrep "recipient@destination.com" /var/log/exim_mainlog

exigrep is the better tool: it groups all log lines for a single message together, so you see the full arc — arrival, attempts, final state — in one block.

The fix

When delivery “looks normal” but the receiver insists nothing arrived, walk this sequence:

  1. Find the message ID from the sender’s mail client or the queue. Use exim -bp to list the queue and grep for the recipient.
  2. Run exigrep <message-id> /var/log/exim_mainlog and inspect the arc. Look for the => line. If it’s there, the local server thinks it delivered. The next step is the receiving server.
  3. Note the IP Exim delivered to — that’s the receiving MX. If the receiver claims nothing arrived, give them the IP, the timestamp, and the message ID; their mail admin can find it on their side.
  4. Watch for R=*_router annotations. If you see R=virtual_aliases or R=virtual_user, the message landed locally — check the maildir on disk.
  5. For deferred messages, the == line includes the SMTP error code from the remote. 4xx is transient, 5xx is permanent. The error text often names the real reason — IP reputation, content scanner verdict, recipient quota.

For environments where mail-trace requests are frequent and need to be answered in minutes, Stack Harbor builds the log-tailing tools into cPanel server management.