Quick answer
If your WordPress site is sending spam emails, it has most likely been hacked and a hidden mailer script, rogue plugin or stolen SMTP login is using your server to send bulk mail under your domain.
The fix is to stop the sending, find and remove every mailer and backdoor, close the way in, reset all passwords, then repair your domain’s email reputation so your real emails reach inboxes again.
Your inbox fills with “Mail Delivery Failed” messages for emails you never sent. Or your host writes to say your account is sending spam and email has been limited.
Either way, someone is using your website to send mail. It is fixable, but the longer it runs, the more damage it does to your domain’s reputation.
I’m Hassan. Our team has been fixing hacked WordPress sites since 2011, working from Pakistan for site owners in the US, UK, EU and Australia. This guide explains how the spam gets sent, where it hides and how a proper WordPress malware removal service shuts it down for good.
Signs your site is sending spam
One sign on its own may be nothing. Two or more together usually mean outbound spam:
- Floods of bounce-back emails. “Undelivered” or “Delivery Status Notification” messages for mail you never sent.
- A warning from your host. It mentions outbound spam, abuse, a mail queue or a sending limit.
- Your real emails land in spam. Clients say your invoices or replies went to their junk folder.
- A blocklist listing. Your domain or server IP shows up on a public email blocklist.
- Sending stops working. Order emails or contact form notifications suddenly fail.
- Complaints from strangers. People reply angrily to messages that appear to come from you.
Warning
Do not just wait for it to stop. Outbound spam is a common reason hosts suspend accounts, and every day it runs makes your domain harder to trust.
Why hacked sites send spam, in plain English
Spammers need servers with a clean reputation. A small business website on a decent host is ideal, because mail from it is more likely to get through.
So once an attacker gets into WordPress, often through an outdated plugin or a reused password, they plant a small mailer and start sending. Your site keeps looking normal to you and your visitors.

What the spam usually is
- Phishing. Fake bank, delivery or account warnings that try to steal logins.
- Scam and pharma offers. Bulk advertising for dubious products.
- Malware links. Messages that push people to infected downloads or pages.
Not every spam problem is a hack. If you are getting fake sign-ups or junk messages into your site, that is a different problem; see our guide on stopping spam email subscribers in WordPress.
What it looks like in your inbox and in Gmail
The image below is a labelled example with placeholder wording, not a real inbox or client site.

In your inbox
Bounce messages arrive in batches, often to addresses you have never heard of. Open one and look at the original message inside: that is the spam being sent in your name.
For the people you email
- Gmail and Outlook may put your messages in spam or show a warning that the message looks suspicious.
- Some providers reject your mail outright with a bounce that mentions a blocklist or poor reputation.
- In Google search there is usually no visible sign, unless the hack also added spam pages or phishing pages to the site.
If spam pages are also showing in Google, read our guide to WordPress SEO spam as well.
Where spam mailers hide
These are the places we check first. It is not a full list.

- Mailer scripts. Small PHP files in
wp-content/uploads, theme folders or the site root, often with random names. - Rogue or nulled plugins. A plugin you did not install, or a “free” premium plugin with a hidden mail function.
- A stolen SMTP login. The password in your SMTP plugin or email account is used from somewhere else.
- Abused forms. A form that lets visitors choose the recipient or send copies can be turned into a spam relay.
- Cron jobs and backdoors. Scheduled tasks or hidden files that bring the mailer back. See our guide to a WordPress backdoor and hidden admin users.
The snippet below is a harmless, shortened example of the pattern a mailer often follows. It is not taken from a client site:
<?php
// EXAMPLE ONLY: shortened, defanged pattern, not real client code
// A hidden file that sends whatever list and message it is given
$list = explode( "\n", base64_decode( $_POST['l'] ) );
foreach ( $list as $to ) {
mail( $to, $_POST['s'], $_POST['m'] );
}
Real mailers are usually disguised and much longer. Red flags are mail( calls next to encoded strings, and any PHP file in wp-content/uploads.
Safe checks you can do first
These checks only look. They do not change anything on the site, so they are safe to do before you decide on a cleanup.

- Open a bounce message and view the original headers. Note the sending server and any script path or
X-PHP-Scriptline. - Ask your host for the mail logs or mail queue for the last few days, and whether they have found a script.
- Look up your domain and server IP on a public blocklist checker.
- Check your DNS for SPF, DKIM and DMARC records, and whether DMARC reports show senders you do not recognise.
- In WordPress, look for admin users, plugins or SMTP settings you did not add.
Tip
Save a few bounce messages before you delete them. Their headers are often the fastest way to find which script sent the spam.
An example of the header lines worth looking for, with placeholder values:
Received: from server1.example-host.com (203.0.113.10)
X-PHP-Script: example-site.com/wp-content/uploads/2026/01/xyz.php
From: "Account Team" <[email protected]>
Subject: Your account has been locked
Cleanup steps, in order
Order matters. If you reset passwords before removing the backdoor, the attacker can simply take the new ones.
Stop the sending
Pause outbound mail with your host if possible, and back up files and database before deleting anything.
Find the source
Use the bounce headers, mail logs and a full file scan to locate every mailer, rogue plugin and backdoor.
Remove malware and backdoors
Delete the mailers and injected code, and check the database, cron jobs and mu-plugins too.
Reinstall clean code
Reinstall core, themes and plugins from trusted sources. Remove anything nulled, unused or abandoned.
Reset all access
New passwords for WordPress, hosting, FTP, database, SMTP and email accounts, new security keys and two-factor login.
Repair and monitor
Request delisting, tighten SPF, DKIM and DMARC, tell your host, then watch mail volume for several weeks.

If you’d rather not do this yourself, our WordPress malware removal service covers finding the mailer, the full cleanup, hardening and a summary for your host, with a reinfection warranty. When you compare offers for WordPress spam email cleanup, ask whether the entry point and your email reputation are included, not just the visible script.
Repairing your email reputation
Once the spam has stopped, your domain still needs time and a little help to recover.
- Request delisting from each blocklist that lists you, using its own removal process.
- Set up SPF, DKIM and DMARC so only your real mail services can send as your domain.
- Send through a proper SMTP service rather than the server’s default mail function.
- Tell your host what was fixed so they can lift any sending limit.
- Watch the numbers. Bounces, complaints and DMARC reports should fall to normal within a few weeks.

Risks of fixing it yourself
If you know your server and WordPress well, you can do much of this. The risk is a cleanup that looks finished but isn’t.
- A second mailer missed. Attackers often plant several, in different folders.
- The backdoor left in place. The spam returns a few days later and your reputation drops further.
- A host suspension. Repeated spam often leads to the account being disabled.
- Stolen email passwords ignored. If the SMTP or mailbox login was taken, cleaning WordPress alone will not stop it.
- Breaking the site. Blind edits to
wp-config.php,.htaccessor the database can take it offline. - Lost business email. Every day of spam means more real messages to clients ending up in junk.
If the host has already disabled the site, read our guide to a WordPress site suspended for malware.
How to stop it happening again
- Update everything. Core, plugins and themes, soon after updates are released.
- Remove what you do not use. Delete unused plugins, themes and old test installs.
- Never use nulled plugins or themes. Buy or download from the official source.
- Use strong, unique passwords and two-factor login for WordPress, hosting, SMTP and email.
- Protect your forms. Never let visitors set the recipient, and add spam protection.
- Monitor. Watch for file changes, new admin users, bounce spikes and host security emails.
For a full hardening checklist, see how to secure a WordPress website from hackers. If the spam keeps coming back after cleanups, read why a WordPress site keeps getting hacked.
Get it fixed: fixed prices
Every plan is cleaned within 24 hours of receiving working access. Emergency fixes start from $149.
- Basic — $149. Malware and backdoor removal with basic hardening. 30-day reinfection warranty.
- Full Recovery — $249. Deep cleanup plus Google review. 60-day reinfection warranty.
- Emergency — $349. Work starts within 4 hours of access. 60-day reinfection warranty.
Is your site sending spam?
Fixed-price malware and mailer cleanup from $149, with a reinfection warranty. Not sure what is sending it? Start with a free malware check.
Related reading
- WordPress site suspended for malware? How to get your host to restore it
- WordPress backdoor and hidden admin users: how to spot and remove them
- WordPress site keeps getting hacked? Why malware comes back and how to stop it
- WordPress SEO spam: how to find injected spam pages and remove them
- How to stop spam email subscribers in WordPress
- How much does WordPress malware removal cost?
Frequently asked questions
Why is my WordPress site sending spam emails?
Usually because the site has been hacked and a hidden mailer script, rogue plugin or stolen SMTP login is being used to send bulk mail. Less often, a contact or signup form with no spam protection is being abused to send messages through your site.
How do I know if the spam is coming from my website or my email account?
Look at the headers of a bounced message. If the sending server is your web host and the headers mention a PHP script or your site’s path, the website is the source. If the spam was sent through your mailbox provider after a normal login, the email account itself is compromised.
Will deleting the spam script stop the emails?
Only for a while, in most cases. Attackers usually leave a backdoor, so a new mailer appears days later. You need to find the way in, remove every backdoor and reset all passwords as well.
Why are my real emails going to spam?
When your domain or server sends spam, mail providers lower its reputation and may add it to blocklists. Your normal emails then look risky and land in junk folders until the spam stops and the reputation recovers.
My host limited or blocked email sending. What should I do?
Ask the host for the mail logs or the script they found, clean the site fully, then reply with a short summary of what was removed and fixed. Most hosts lift the limit once the spam has stopped.
How do I get my domain off an email blocklist?
First stop the spam and fix the cause, otherwise you will be listed again. Then use each blocklist’s own lookup and removal process. Some remove listings automatically after a quiet period; others need a request.
Do SPF, DKIM and DMARC stop a hacked site sending spam?
Not on their own. They tell receiving servers which senders are allowed to use your domain, which helps against spoofing and shows when something is wrong. If malware sends through an allowed server, you still have to remove it.
Is this the same as getting spam sign-ups or contact form spam?
No. Fake sign-ups and form spam are messages coming into your site. This guide is about your site or server sending spam out. If your problem is fake subscribers, see our guide on stopping spam email subscribers in WordPress.
Can a hacked site that sends spam be suspended?
Yes. Outbound spam is one of the most common reasons hosts suspend an account, because it harms their servers’ reputation and other customers. Cleaning it quickly lowers that risk.
How much does it cost to fix a WordPress site sending spam emails?
BrandBees charges $149 for a Basic cleanup with a 30-day reinfection warranty, and $249 for Full Recovery or $349 for Emergency, both with a 60-day reinfection warranty. Emergency fixes start from $149.
Want the spam stopped, for good?
WordPress experts since 2011. Cleanup from $149, cleaned within 24 hours of access, with a 60-day reinfection warranty on the $249 and $349 plans.
Free PDF
WordPress Security Checklist
The same checks we run on client sites, written in plain English. Work through it in an afternoon.
- Logins, updates, backups and hosting, step by step
- A 10-minute self-test you can run today
- What to do if you think you’ve been hacked