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.
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
- Log in to your hosting control panel and check for account suspension notices or email sending limits.
- Change all administrator, FTP, and database passwords immediately.
- Enable two-factor authentication on all admin accounts where available.
- Update your CMS, themes, and plugins to the latest versions.
- Scan your website files for malicious code or unauthorized uploads.
- Check cron jobs for scheduled spam scripts.
- Remove any suspicious user accounts created without your knowledge.
- Review and tighten contact form settings to prevent abuse.
- Verify SPF, DKIM, and DMARC records are correctly configured.
- 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.
- cPanel: Log in and check the Metrics section for Bandwidth usage, then open Email > Track Delivery to review the mail queue.
- Plesk: Log in and navigate to Mail > Mail Settings, then check Home > Statistics for resource alerts.
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:
- Your hosting control panel
- Your CMS administrator account
- FTP or SFTP accounts
- Your website database
- Any connected email accounts
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:
- Go to the Updates or Dashboard section.
- Update the core CMS software first.
- Update all installed themes and plugins.
- 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:
- Recently modified PHP files you did not edit
- Unknown files in upload directories such as
wp-content/uploads - Encoded or obfuscated code in theme or plugin files
- Unauthorized administrator user accounts
- Suspicious entries in
wp-config.php, such as unexpecteddefine()statements or remote include statements
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.
- cPanel: Go to Advanced > Cron Jobs and review the Current Cron Jobs list. Delete any entries you do not recognize, especially those calling
php,curl, orwgetwith unfamiliar URLs. - Plesk: Go to Websites & Domains > Scheduled Tasks and review the list. Remove any tasks you did not create.
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:
- Add CAPTCHA or reCAPTCHA to all public forms.
- Enable rate limiting to restrict submissions per IP address.
- Validate and sanitise all form inputs on the server side.
- Disable email notifications for form submissions if they are not needed.
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.
- cPanel: Go to Email > Track Delivery or Email > Email Deliverability to inspect the mail queue and delivery attempts.
- Plesk: Go to Mail > Mail Settings and use the mail queue management tools to review outgoing messages.
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:
- cPanel: Go to Metrics > Errors to view
error_logentries. - Plesk: Go to Websites & Domains > Logs to review error and access 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.
- SPF (Sender Policy Framework): A DNS TXT record that lists which mail servers are authorised to send email for your domain. In cPanel, go to Email > Email Deliverability to generate and install an SPF record. In Plesk, go to Websites & Domains > DNS Settings to add a TXT record.
- DKIM (DomainKeys Identified Mail): Adds a digital signature to outgoing emails. Enable DKIM in cPanel under Email > Email Deliverability, or in Plesk under Mail > Mail Settings. Publish the generated public key as a DNS TXT record.
- DMARC (Domain-based Message Authentication, Reporting & Conformance): A DNS TXT record that tells receivers how to handle emails that fail SPF or DKIM checks. Add a DMARC record via your DNS host, typically at
_dmarc.yourdomain.com.au, starting with a monitoring policy such asv=DMARC1; p=none; rua=mailto:dmarc-reports@yourdomain.com.au.
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:
- MXToolbox (mxtoolbox.com) for multi-blocklist lookups
- Spamhaus (spamhaus.org) for the SBL, XBL, and PBL lists
- Barracuda Reputation Block List (barracudacentral.org)
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:
- Google Search Console: Go to Security & Manual Actions > Manual Actions and request a review.
- Bing Webmaster Tools: Use the Site Security or Support section to submit a reconsideration request.
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?
💻 Open a Ticket