Unexpected outbound mail can come from a compromised mailbox or website on a cPanel server. This guide explains how an administrator can inspect Exim’s queue, identify the source and remove confirmed unwanted messages.
Inspect the queue
With administrator SSH access, list queued messages and the queue size:
exim -bp
exim -bpcA large queue can also result from delivery failures, so it does not prove spam by itself. Record message IDs that need investigation.
For a selected message, replace MESSAGE_ID in the following commands with its actual Exim queue ID:
exim -Mvh MESSAGE_ID
exim -Mvl MESSAGE_IDThese display the message headers and message log. If you need to inspect its contents, treat them as private customer data:
exim -Mvb MESSAGE_IDIdentify and contain the source
Review the matching entries in /var/log/exim_mainlog or WHM’s Mail Delivery Reports. Look for the authenticated mailbox, local account or script path associated with the messages; a visible From address alone can be forged.
Suspend outgoing mail for the confirmed affected account where appropriate. Reset compromised credentials and investigate vulnerable scripts or malware before allowing it to send again. Blocking one source IP does not fix a compromised website or stolen mailbox credentials.
Remove confirmed unwanted messages
Removing a queued message discards it without sending a delivery failure notification. Do not empty the whole queue or pipe all queue IDs into a deletion command: this can delete legitimate customer mail.
After confirming the exact message, remove only that ID:
exim -Mrm MESSAGE_IDCheck the command result and inspect the queue again. Active deliveries may not be removed by this command. Deleting a queued message does not require an Exim restart and does not recall mail already delivered.
Continue monitoring the source and queue to confirm that the unwanted sending has stopped.