Home / Guides

Server guide

Server sending spam or on a blacklist? How to check Exim

If your mail bounces, lands in spam, or your IP is on a blacklist, one hacked site or mailbox is often sending spam. Find that source first.

2 min readUpdated November 2026 by the RootManage teamWorks on Ubuntu, Debian, AlmaLinux and Rocky unless noted

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

terminal
exim -bpc                 # number of queued messages
exim -bp | exiqsumm | sort -n | tail

Thousands of messages to many different domains from one sender is a strong sign of spam.

Find the source

terminal
grep cwd= /var/log/exim_mainlog | grep -v /var/spool | awk -F'cwd=' '{print $2}' | awk '{print $1}' | sort | uniq -c | sort -rn | head

The 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.

Want a person to look at it?

Tell us what you see. We reply with what we think is wrong and what it would take to fix it.