Home › Knowledgebase › KB-1201

Why is my website sending spam emails and how do I fix it

Summary

This guide helps you troubleshoot and resolve: Why is my website sending spam emails and how do I fix it. Follow the steps below to fix the issue.

Quick Tip: Need immediate assistance? 💻 Open a Ticket

Common Causes

Your website may look perfectly normal while quietly sending thousands of spam emails in the background. Attackers do not always deface pages or steal data; they often compromise outdated plugins, themes, or CMS components to turn your hosting account into a spam relay. When this happens, your business emails can start bouncing, legitimate messages land in spam folders, and your hosting provider may suspend your account to protect the reputation of shared mail servers. This guide explains how to identify the problem, clean your site, and restore trust with mail providers and search engines.

Quick Fix Steps

  1. Log in to your hosting control panel and check for account suspension notices or email sending limits.
  2. Change all administrator, FTP, and database passwords immediately.
  3. Enable two-factor authentication on all admin accounts where available.
  4. Update your CMS, themes, and plugins to the latest versions.
  5. Scan your website files for malicious code or unauthorized uploads.
  6. Check cron jobs for scheduled spam scripts.
  7. Remove any suspicious user accounts created without your knowledge.
  8. Review and tighten contact form settings to prevent abuse.
  9. Verify SPF, DKIM, and DMARC records are correctly configured.
  10. Request removal from email blocklists and submit search engine reviews once your site is clean.

Detailed Instructions

1. Check Your Hosting Account Status

Log in to your hosting control panel and look for suspension warnings, bandwidth alerts, or email quota notifications.

If your account has been suspended for spam activity, you will usually see a banner or message explaining the reason. Do not attempt to send large volumes of email until the underlying issue is resolved, as this can extend the suspension.

2. Change All Passwords

Attackers often gain access through stolen credentials. Change passwords for:

Use strong, unique passwords for each service. Avoid reusing passwords across different platforms. Enable two-factor authentication on your hosting control panel and CMS administrator account to prevent unauthorized access even if credentials are compromised.

3. Update Your CMS and Components

Outdated WordPress, Joomla, Drupal, or other CMS installations are a common entry point. Log in to your website administrator area and apply all available updates:

  1. Go to the Updates or Dashboard section.
  2. Update the core CMS software first.
  3. Update all installed themes and plugins.
  4. Remove any plugins or themes you no longer use.

After updating, check that your website still functions correctly.

4. Scan for Malicious Files

Use a reputable security scanner or malware removal tool to examine your website files. Look for:

In WordPress, also check wp-mail.php. If you do not use email posting, consider disabling or renaming this file to prevent abuse. If you are not comfortable editing code yourself, engage a web developer or security specialist to perform the cleanup.

5. Check Cron Jobs for Scheduled Spam Scripts

Attackers often schedule spam scripts to run automatically via cron jobs, making the activity harder to detect during manual file scans.

6. Remove Unauthorized User Accounts

In your CMS admin panel, navigate to Users and review the list of accounts. Delete any accounts you do not recognise, especially those with administrator privileges. Attackers often create hidden admin accounts to maintain access after you change your password.

7. Secure Your Contact Forms

Spammers frequently exploit unprotected contact forms to send mail through your server. Take these steps:

8. Review Email Logs and Headers

Check your hosting control panel's email logs to identify which scripts or accounts are sending messages. Look for high volumes of outgoing mail from unusual email addresses or PHP scripts.

Inspect the full email headers of bounced or spam-flagged messages. Look at the Received, X-Spam-Status, Authentication-Results, and Received-SPF headers to determine whether the mail originated from your server and whether SPF, DKIM, or DMARC checks failed.

Also check server error logs alongside email logs:

If you do not use PHP-generated email from your website, consider disabling the mail() function. In cPanel, this can often be managed via Software > Select PHP Version > Options, or by asking your hosting provider to disable it in php.ini.

9. Configure Email Authentication: SPF, DKIM, and DMARC

Email authentication records tell receiving mail servers that messages from your domain are legitimate. Without them, your emails are more likely to land in spam folders.

After making DNS changes, allow up to 48 hours for propagation, then use a lookup tool to verify the records are published correctly.

10. Request Removal from Blocklists

If your domain or IP address has been added to email blocklists, your messages will continue to bounce or go to spam even after cleanup. Use these blocklist lookup tools to check your status:

Follow each provider's removal process. This often requires proving that your site is secure, that you have fixed the vulnerability, and that SPF, DKIM, and DMARC are correctly configured.

11. Request a Search Engine Review

If search engines have flagged your site as compromised, visitors may see warning pages instead of your content. Once your site is clean, submit a review request through the relevant search engine's webmaster tools:

This process can take several days.

Regular backups are essential. Before making significant changes, download a full backup of your website files and database so you can restore if something goes wrong.

Do not simply delete suspicious files without understanding how they got there. If you close the vulnerability but leave the attacker's access point open, the spam will likely return.

Troubleshooting

Emails Still Bouncing After Cleanup

Mail provider reputations take time to recover. Even after your site is clean, some emails may continue to bounce for a few days. Monitor your bounce messages and check blocklist status weekly until delivery returns to normal.

Emails Landing in Spam Without Bouncing

If messages are delivered but consistently land in spam folders, the issue is usually reputation or authentication rather than a blocklist. Inspect the full email headers of a message sent to Gmail, Outlook, or another major provider. Check for Authentication-Results failures on SPF, DKIM, or DMARC. Verify your DNS records using MXToolbox and ensure your domain is not listed on Spamhaus or Barracuda. Gradually rebuild sending reputation by reducing volume and ensuring all outgoing mail passes authentication checks.

Cannot Access Hosting Control Panel

If your account has been suspended, you may lose access to email and file management. Contact your hosting provider's support team for assistance.

Website Redirects to Spam Pages

If visitors are being redirected to unrelated sites, your .htaccess file or database may have been modified. Restore these from a known clean backup and scan for malicious redirect code.

Contact Form Still Sending Spam

Disable the contact form temporarily while you implement CAPTCHA and input validation. Do not re-enable it until you are certain the vulnerability is patched.

If you host with us, you don't need to do this yourself — just Open a Ticket and our Brisbane team will get it sorted.

Still Having Issues?

Need more help? If the issue persists after trying these steps, please open a support ticket and our team will assist you.

💻 Open a Ticket