Introduction
Exim is a widely used mail transfer agent (MTA) on Linux servers, especially in cPanel/WHM environments. It is responsible for handling the sending, receiving, and routing of emails. Managing the mail queue and troubleshooting email issues using Exim commands is essential for maintaining smooth email delivery.
Prerequisites
Before using Exim commands, ensure the following:
- Root or sudo access to the server
- Basic knowledge of Linux command line
- Exim service installed and running
- Access to SSH terminal
- Understanding of message IDs and email queue
Implementation
1. Delete mails older than a day
2. View mails in queue for a specific user
3. View message details
exim -Mvb $MSGID # View body
exim -v -M $MSGID # View transaction
4. Force delivery of a message
5. Run mail queue manually
exim -qff # Force queue run including frozen mails
6. View logs for a message
7. Remove or manage messages
exim -Mg messageID # Bounce message to sender
8. Check queue statistics
exim -bp # List messages
exim -bpr | grep “<“ | wc -l # Count queued mails
exim -bpr | grep frozen | wc -l # Count frozen mails
9. Delete frozen messages
10. Delete emails from specific sender
11. Update Exim
Conclusion
Exim commands provide powerful control over email queue management and troubleshooting. By using these commands, administrators can monitor, manage, and resolve email delivery issues effectively. Regular maintenance of the mail queue helps ensure optimal server performance and prevents email-related problems.