Stop spam on a simple HTML website contact form
Many Indian small businesses, like a CA office, a tiles dealer or a tuition centre, run a five-page HTML website made years ago. The contact form posts to a small PHP mail script. Lately the owner gets fifty spam emails a day through it, and the hosting company warned that the server is sending junk mail. There is no WordPress plugin to install. This guide shows how to fix spam on such a basic site with minimal changes.
Why simple sites get so much spam
- The mail script accepts any input, so bots find it and send links in every field, many times a day.
- Some bots inject extra headers into the mail script to send spam to other people through your server.
- The hosting company flags your account for spam sending, and genuine emails from your domain start landing in junk.
- The original developer is no longer reachable, so the owner does not know how to change anything safely.
Fixing a basic contact form
- Find out how the form sends mail. Ask your hosting support or a developer to look at the PHP file the form posts to. Check whether it validates fields and whether it lets users set the From or extra headers. Old scripts often allow header injection, which is the most urgent thing to fix.
- Lock down the mail script. The script should send only to your own address, with a fixed From address on your domain. User input goes only in the message body and Reply-To, after validation. Reject line breaks in name and email fields. This alone stops your server from being used to spam strangers.
- Add a background bot check. Static sites can still use a script tag. Add a lightweight protection script to the contact page and a matching check in the PHP mail file. Bots are stopped, visitors fill the form as usual. No puzzle, and no need to move the site to a new platform.
- Limit submissions per visitor. A real customer sends one message. Limit submissions per IP to a few per hour. If your script logs submissions, check for repeat sources. This reduces both spam and the load on your hosting mail limits.
- Check results after a week. Count spam emails for a week after the change. If they drop sharply, you are done. If some continue, check whether they are human sales pitches, which is a different issue, or a new bot pattern. Keep a copy of the changed files in case you change hosting.
How VadiGuard helps
Works on plain HTML and PHP
VadiGuard offers drop-in protection for vanilla JavaScript and static sites, plus a framework-agnostic PHP integration. A tiles dealer's five-page site does not need to move to a new platform. One script tag and a few lines in the mail script are usually enough.
Spam and fake emails filtered
The anti-spam filter stops junk submissions, and fake email detection removes throwaway addresses. Bot detection catches automated posts. Your inbox gets real enquiries, and your hosting account is less likely to be flagged for sending junk.
A dashboard for a non-technical owner
The live dashboard shows blocked submissions, and the AI threat summary sends a plain-English digest each day. The owner can see the spam going down without reading server logs, and a freelancer can check it from anywhere.
An old HTML site does not need a rebuild to stop spam. Lock down the mail script, add a background check, limit repeats and review after a week. If you need help, the VadiGuard team can guide your developer through the setup.
Questions people ask
Do I need to move my site to WordPress?
No. VadiGuard works on plain HTML and JavaScript sites with a script tag, and with plain PHP for the server side. Your existing site can stay as it is.
I don't know any code. Can I do this myself?
Adding a script tag is simple, but changing the PHP mail file safely is best done by a developer or your hosting support. It is usually a small job.
What about spam from real people selling services?
Human pitches are harder to block. VadiGuard's AI lead classifier can mark low-quality submissions, helping you separate them from genuine customer enquiries.
Will the form stop working if VadiGuard is offline?
No. VadiGuard fails open, so if its service cannot be reached, the contact form keeps sending as normal.