I. Useful Commands (do not include brackets!)
See the mail queue count:
View the mail queue with email IDs:
Force delivery of specific email by ID:
Force a queue run:
Force a queue run and attempt to flush frozen emails:
View log of email by ID:
View body of email by ID:
View header of email by ID:
Remove message without error code (no bounce) by ID:
Fail a message from the queue (with bounce) by ID:
II. Configuring A Better “log_selector” In Exim Configuration For Extended Logging!
By default Exim on cPanel does not come with a very extensive logging setup enabled (log_selector) in it’s /etc/exim.conf. Generally without reconfiguring this line you will not be able to easily figure out most of the issues going on with your mail. It’s very hard to find a spammer or source of a particular email from your server. The reason for this default is probably because cPanel developers figure most people won’t need to parse logs as their target administrators are relatively “green” to Linux and the default also keeps log sizes very small. I recommend editing /etc/exim.conf and replacing the existing “log_selector” line (or adding it if none exists) with:
Then you should run:
This will restart exim and you should see much more detailed logs in /var/log/exim_mainlog!
III. Exim Tips & Tricks.
Many of these tips and tricks should be used with the extended logging setup discussed in section II.
Show exim queue stats by domain:
SMTP connection counter:
Find spammers sending mail from their /home/ directory (through a script):
Flush the exim queue (empty it!):
IV. RBL and Whitelist Filtering bypass.
To bypass RBL filtering for a specific domain you can add that domain to /etc/rblbypass. You can add a remote IP address of a host that is being rejected by a RBL to /etc/whitelist to bypass RBL filtering for a specific incoming IP.
V. Open Extra SMTP Port via cPanel.
You may find that a customer’s ISP blocks port 25 to prevent outbound spam from their network. In this case you could open a second port for him or her to use to get around the ISP.
- In your WHM go to Service Configuration -> Service Manager.
- Scroll to the bottom where you will see: Exim on another port.
- Check both boxes (Enable and Monitor) and fill in the box for port 26 (or your other port of choice!)
- Save the configuration and you should be set!
You can test it out with telnet or an email client that sends through SMTP.
VI. Where to go from here.
Aside from this guide I also recommend studying the Exim documentation and learning everything you can about how email works and to make sure you are fully understanding how to read email headers. It’s simple to read headers, but from my work as a systems administrator I know a lot of admins (even good ones) fail to do so properly or are unsure of their conclusions!