💾

Exim

1 notes  •  Databases

Manage the Exim Mail Queue via SSH

Use SSH command-line tools to view, inspect, retry, and delete messages stuck in the Exim mail queue on a VPS or dedicated server.

Prerequisites

  • Root or sudo SSH access to the server
  • Exim installed as the MTA (common on cPanel/WHM servers)

View the Queue

# Count messages in the queue
exim -bpc

# List all queued messages (ID, sender, recipient)
exim -bp

# Summarise the queue
exim -bp | exiqsumm

Inspect a Message

# Show headers of a specific message
exim -Mvh MESSAGE_ID

# Show body of a message
exim -Mvb MESSAGE_ID

# Show full message (headers + body)
exim -Mvc MESSAGE_ID

Retry and Flush

# Force immediate delivery attempt for all queued messages
exim -qff

# Force delivery of a single message
exim -M MESSAGE_ID

# Retry all frozen messages
exim -qff -Rf

Delete Messages

# Delete a single message
exim -Mrm MESSAGE_ID

# Delete all frozen messages
exim -bp | awk '/frozen/{print $3}' | xargs exim -Mrm

# Delete ALL queued messages (use with caution)
exim -bp | awk '{print $3}' | xargs exim -Mrm

Search the Queue

# Find messages to or from a specific address
exiqgrep -r user@example.com
exiqgrep -f sender@example.com

# Find frozen messages
exiqgrep -z

Notes

  • On cPanel servers, use WHM → Email → Mail Queue Manager for a GUI alternative.
  • Always check mail logs (/var/log/exim_mainlog) to diagnose why messages are frozen.