Integrations · Mail servers and panels
Check outgoing recipients on cPanel & WHM
A WHM plugin for hosting companies that run cPanel & WHM. It checks the outside recipients of the mail your customers send through the server's Exim, while each message is submitted. By default it only logs each result; refusing recipients that cannot receive mail is yours to turn on. When our API or the plugin's helper is slow or down, the mail goes out as usual: a check never holds a message more than a few seconds.
It is the cPanel part of our Exim recipe, in the same zip: ev-exim-1.0.0.zip, which unpacks into a folder ev-exim/, with the plugin in ev-exim/whm/. It is under the MIT licence (LICENSE in the zip). It has not been run on a real cPanel server yet: it was built from cPanel's documentation and tested against a model of a cPanel server, so install it on a test server first. There is no cPanel Marketplace listing or package repository yet.
What you need
- cPanel & WHM 110 or later with its own Exim, on a system your version supports (cPanel's system requirements): AlmaLinux 8, 9 (114 or later) or 10 (132 or later), CloudLinux 8 or 9, CloudLinux 10 (134 or later), or Ubuntu 24.04 (132 or later). cPanel no longer supports Rocky Linux.
- Python 3 (standard library only). On AlmaLinux 8, install it first with
dnf install python3; without it, the installer uses the system's/usr/libexec/platform-python. - systemd (any version cPanel supports: the plugin picks how the helper gets the key).
- Root on the server.
- An API key from the API keys page with the permission Validate addresses, made for this server, with a daily credit cap. One key per server: a cap per server bounds what each can spend, and revoking one key stops one server.
What gets checked
Only outbound mail: the sender has authenticated (a mailbox or a cPanel user) or connects from a relay host, and the recipient's domain is not one this server receives mail for. Mail arriving for your customers' mailboxes is never checked, and nor are messages submitted with the sendmail command.
Install on one server
Copy the zip to the server and unpack it, then, as root, in the folder that holds
ev-exim/:sh ev-exim/whm/install.shIt installs the helper, its systemd socket and service, and the WHM page, and registers the page. Without a key it stops there: nothing in Exim's configuration changes yet.
Open WHM → Plugins → email-validation.org recipient checks, paste the key and choose Save and test. The test is one free check of a test address (no credit, no mail server contacted). A key the API refuses is not saved. Once the key is saved, checks start in log only mode.
Look at the page's Status: checks on, the statements in Exim's configuration, the helper answering.
The installer is safe to run again, and running the one from a newer zip is how you upgrade: your key and settings stay.
Install on many servers
Every step has a command, so a hosting company can roll it out over SSH without opening WHM on each server. The key is read from a file or from stdin, never from the command line (where ps and the shell's history would show it), and is never printed. From your admin machine, for one server, with that server's key in a file readable only by you:
scp ev-exim-1.0.0.zip root@server1.example.com:/root/
ssh root@server1.example.com 'cd /root && unzip -oq ev-exim-1.0.0.zip && sh ev-exim/whm/install.sh'
ssh root@server1.example.com 'python3 -I /usr/local/lib/ev-helper/ev_whm.py set-key' < server1.key
ssh root@server1.example.com 'python3 -I /usr/local/lib/ev-helper/ev_whm.py status'set-key does what Save and test does: one free test check, then the key is saved root-only and checks start. Roll it out to a few servers first, watch them for a few days in log only mode, then go on with the rest. On AlmaLinux 8 without python3, use /usr/libexec/platform-python -I instead of python3 -I.
Command (python3 -I /usr/local/lib/ev-helper/ev_whm.py …) | What it does |
|---|---|
set-key or set-key --file <path> | tests the key from stdin or the file and saves it, as Save and test |
test-key | one free check of a test address with the saved key |
settings --checks on or off | turns checks on or off; off takes the statements out of Exim and keeps the key |
settings --mode log or refuse | the mode |
settings --region us or eu | the API host: global, or EU data residency |
remove-key | takes the statements out of Exim, then removes the key and stops the helper |
status | on or off, the mode, whether the statements are in Exim, whether the helper answers, today's counts |
A setting you do not name stays as it is, and --checks on needs a saved key. A command that fails prints the reason and exits with a non-zero status.
Modes and settings
- Log only (default): every recipient is accepted, and each checked one gets an Exim log line with its status and reason. The plugin's line names the recipient's domain only (Exim's own delivery lines name addresses, as they always do).
- Refuse: a recipient whose result is
invalidbecause it has no mailbox, no DNS, no inbound mail or is unroutable is refused at once, so your customer sees it in their mail program instead of a bounce later, and the other recipients still get the message.unknownanduncheckedresults are never refused. Turn it on when your servers' sending reputation matters more to you than the chance of a wrong refusal. - Region: the global API host, or the EU one.
The helper's limits, its cache and its daily cap are in /etc/ev-helper/ev-helper.conf, as in the Exim guide's costs section.
How it changes Exim
cPanel builds /etc/exim.conf from its own inputs, and its documentation says not to edit that file by hand: a direct edit lasts only until the next rebuild. So the plugin writes only the places cPanel keeps for customisations: the main section of /etc/exim.conf.local (what the Exim Configuration Manager's Advanced Editor writes) and a custom RCPT ACL block file under /usr/local/cpanel/etc/exim/acls/. Its lines sit between # BEGIN ev-exim-whm and # END ev-exim-whm markers. Your own customisations in those files stay as they are.
Every change is one checked step: it backs up those files and the running /etc/exim.conf, writes its lines, runs /scripts/buildeximconf, then checks that exim -bV loads the result, that its statements run before cPanel's accept for authenticated senders, and that a test SMTP session with exim -bh shows no new error (nothing is received or sent). Only then does it restart Exim with /scripts/restartsrv_exim. If any step fails, it puts every file back, puts back the exact configuration Exim was running and shows the error.
Roll back
- A failed change rolls itself back, as above: Exim keeps the configuration it ran before.
- Turn checks off on the page, or with
settings --checks off. The statements leave Exim's configuration (rebuilt, checked and restarted), so Exim no longer asks the helper. The key and settings stay, andsettings --checks onputs the statements back. - Stop the helper to stop every check at once without touching Exim:
systemctl stop ev-helper.socket ev-helper.service. Exim then gets no answer and accepts every recipient asunchecked. - Remove the plugin with the uninstaller below.
If the plugin's page and its commands both fail, WHM's Exim Configuration Manager has a Reset tab with an option to disable third-party and custom ACLs. It switches off every custom ACL on the server, not only ours, so use it only as a last resort.
Uninstall
As root:
sh ev-exim/whm/uninstall.sh # or: python3 -I /usr/local/lib/ev-helper/ev_whm.py uninstall
sh ev-exim/whm/uninstall.sh --keep-settings # keeps the key and settings in /etc/ev-helper for a reinstallExim comes first: the statements leave cPanel's inputs, and the configuration is rebuilt, checked and Exim restarted. If that fails, the uninstaller stops and removes nothing, so the helper keeps answering while Exim still asks it. Only then does it stop the helper, unregister the WHM page and remove its files, the key, the settings and the helper's state. It is safe to run twice. Then revoke the server's key on the API keys page.
When something fails
Whatever happens to our API or the helper, mail goes out. Exim waits at most 5 seconds for the helper, and the helper answers within 3: when the API is slow, the recipient is unchecked and the result is cached when it arrives. A failing or unreachable API, a refused key, no credits left, a stopped helper or a missing key all mean unchecked, and the recipient is accepted as usual. The reasons are listed in the Exim guide.
Costs and privacy
Each check costs at most 1 credit, and test addresses, unknown results and errors are free; the helper's cache, its limit per sender and its daily cap bound what it spends, on top of the key's daily credit cap (see the Exim guide). The helper sends only each outside recipient's address, never the message, to https://api.email-validation.org (or https://api-eu.email-validation.org). Its cache holds keyed hashes, not addresses, and the WHM page shows counts only.
Not built yet
- A page for resellers or cPanel users: the plugin is for root, or a reseller with the
allprivilege. - A key or limits per cPanel account or package: one key and one set of limits serve the whole server.
- The optional header of the Exim recipe (tag mode), which on cPanel would need removing in every transport.
- A
.debpackage for cPanel on Ubuntu (use the installer there), a signed package repository and a cPanel Marketplace listing.
Related
- The Exim recipe, for Exim without cPanel
- Test addresses
- Statuses and reasons
- WHMCS, to check the address a client signs up with