The short answer
Count the mail queue, find which account or script sends the mail, stop it, clean the cause, then fix SPF, DKIM, DMARC and reverse DNS and ask the blacklist to delist you.
Look at the queue
exim -bpc # number of queued messages
exim -bp | exiqsumm | sort -n | tailThousands of messages to many different domains from one sender is a strong sign of spam.
Find the source
grep cwd= /var/log/exim_mainlog | grep -v /var/spool | awk -F'cwd=' '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -rn | headThe folder with the most lines is where the sending script lives, for example a hacked WordPress site. Also check for a mailbox with a stolen password: look for many logins from foreign addresses in the Dovecot log.
Stop it
- Freeze or remove the queued spam for that sender only, after saving a few samples.
- Suspend outgoing mail for that account in WHM, or the account itself.
- Change the mailbox passwords.
Remove the cause
Delete the malicious script and find how it got in: an old plugin, a weak password or a vulnerable script. Cleaning only the queue brings the spam back in an hour. See malware cleanup.
Fix the mail setup
- SPF, DKIM and DMARC records for each sending domain.
- Reverse DNS (PTR) for the server IP, matching the mail server name. Your host usually sets it.
- Per-domain hourly send limits in WHM.
Ask for delisting
Check the IP on the blacklist's own lookup page. Each list has its own delist form. They check whether the problem is fixed, so do the cleanup first.
Questions people ask
Why is my mail going to spam?
Missing SPF, DKIM or DMARC, a blacklisted IP, no reverse DNS, or a bad sending reputation. Check each in turn.
Can I just delete the whole queue?
You can, but you will lose real mail too and the cause remains. Find and fix the source first.
How do I prevent it?
Keep CMS and plugins updated, use strong mailbox passwords, set send limits and watch the queue size.