cPanel Max Hourly Emails per Domain: Stop Outgoing Spam
On a fresh cPanel server one compromised account can send without limit. Two Tweak Settings change that, and both are easy to get wrong.
The cPanel setting called Max hourly emails per domain is the cheapest insurance a hosting server has against outgoing spam. cPanel's documentation lists its default as unlimited, which means one hacked contact form can send as much as your server's mail queue will carry, and your IP address pays for it. Setting a limit takes a minute. Setting one that does not also block your legitimate customers takes a little thought.
What the two protections actually do
Both settings live in WHM under Server Configuration, Tweak Settings, on the Mail tab. They are independent: hitting one does not mean you have hit the other.
| Setting | Default | What happens |
|---|---|---|
| Max hourly emails per domain | Unlimited | Caps remote deliveries per domain per hour. Extra messages queue up to 125% of the cap by default, then fail |
| Maximum percentage of failed or deferred messages a domain may send per hour | Unlimited | Works with the count below. When both are met for the previous hour, outgoing mail from that domain is temporarily blocked |
| Number of failed or deferred messages a domain may send before protections can be triggered | 5 | The minimum count before the percentage check can block a domain |
| Count mailman deliveries towards a domain's Max hourly emails | Off | Leave off if customers run large mailing lists, or list subscribers may miss messages |
The failure-based protection is the clever one. A spam run produces a high share of bounces and deferrals, because the addresses are bought or guessed, while a real business mostly emails people who exist. Setting a percentage gives you a brake that responds to the shape of the traffic rather than only its volume.
Pick numbers from real traffic
Before choosing a limit, see what your domains actually send. The Exim main log records each accepted message with the sending domain in the envelope sender, so you can rank domains by volume for a normal day.
grep ' <= ' /var/log/exim_mainlog | grep -v ' <= <>' | grep -oP ' <= [^@ ]+@\K[^ ]+' | sort | uniq -c | sort -rn | head -20
That count includes mail delivered locally, which the limit ignores, so treat it as an upper bound. A newsletter sender or a busy shop will sit far above the rest. Give them a higher value through their own package or account settings, and set the server value for everyone else. A limit somewhat above a normal customer's busiest hour leaves room for a real campaign and still stops a script that sends thousands an hour.
When a domain hits the limit
Customers usually report it as mail that stopped going out. Exim logs the reason, so check before you raise anything.
grep -iE 'max emails per hour|max defers and failures' /var/log/exim_mainlog | tail -20
If the domain normally sends a handful of messages and suddenly hit the cap, assume compromise until you have shown otherwise. The Exim log's U= field names the local user that submitted each message, and a PHP mailer writes its working directory in cwd=, which points at the script. The full investigation is in cPanel Server Sending Spam? Find and Stop the Source. Raising the limit for a compromised account only lets the spam out faster.
-
1
Confirm whether the traffic is legitimate
Look at the recipients and subjects in the queue with
exim -bp | head -50. A real campaign goes to the customer's own list. Spam goes to webmail addresses that have nothing to do with them. -
2
If it is spam, stop the source first
Find the script or mailbox, reset the passwords involved, and clear only that domain's queued messages. Then the limit can stay where it is.
-
3
If it is legitimate, raise that domain only
Change the value for that account or its package, within the server ceiling. Do not lift the server-wide limit to fix one customer.
-
4
Check your reputation either way
A burst that hit the limit may already have reached a blocklist. The delisting steps in Plesk Server Blacklisted? How to Get Your IP Delisted apply to any server.
Verify the limits are in force
Confirm the settings were saved in WHM, then watch the log through a busy period. You want to see the occasional limit event for a sender who genuinely spiked, and nothing for your large legitimate senders. If the log is silent for weeks, your limit may be too high to matter. If a well-known customer appears every day, it is too low for them.
What a fixed hourly cap cannot do
An hourly cap treats every hour the same and every domain the same unless you configure exceptions by hand. It does not notice that an account which sends ten messages a day is suddenly sending two hundred, as long as two hundred is under the cap. BashEmail adds that layer on a cPanel server. It watches outgoing activity per account, supports server-wide limits with overrides for customers who legitimately send more, and moves a suspicious sender through watch, hold and suspension stages. A sending suspension stops outgoing mail only, so the customer can still sign in and receive messages. It installs on the existing server with no MX or DNS change.