How to prevent spam through your web form

Organisations with a contact form on their website know it is important to prevent abuse of that form. Before you know it, spam is lapping over the virtual skirting boards of your inbox. But did you know your form is also a perfect way to spam others? Without you wanting it, your contact form then acts as a spambot. Of course, nobody wants that on their conscience. In this blog, Gerard van Dijnsen explains how to prevent it.
Unreadable text and endless traffic lights
Web forms are often abused to send spam to the website’s owner. Fortunately, there are all kinds of tools these days to prevent that. Whether they are always user-friendly is another question. Take Google’s reCaptcha, a technology meant to determine whether the sender of the web form is a human or a computer program. To pass the test you have to retype a bit of text that nobody can read – well, I can’t – or select certain parts of an image, which never works either. I never manage to identify all the traffic lights, motorbikes or hills.
Your confirmation email is the culprit
Spammers are apparently a lot smarter than me: they found a way around reCaptcha long ago. So you still get all that spam in your inbox. That may not seem so bad in itself, but the problem gets serious the moment your website starts sending automatic confirmation emails.
A spambot against your will
What happens? A spambot fills in your web form, including an email address. Because this is automated, sometimes hundreds of forms are submitted per minute. With hundreds of different random email addresses. Your website is of course clever enough to neatly send a confirmation email to the address that was entered. But your website doesn’t know whether the owner of that email address really is the sender. Spammers gladly take advantage of that. And so you suddenly are the spambot, without knowing it.
Give spammers no chance
By defining exactly what someone may enter in the fields, you can prevent an unwanted message from being sent out into the world through your web form. The moment the form reaches the web server, it is checked on the server side. The email address field may only contain an email address, no other characters. The first name field cannot contain digits, full stops or commas, and certainly no http://. In the question field you should forbid URLs, email addresses and constructions with square brackets or spaces. For those reasons we advise against a free-form field. By being this strict, you give spammers no chance to spread their message and you reduce this kind of attack to virtually zero per cent. Malicious people who try to pull their tricks through your web form soon realise it is pointless and move on to the next site with a less well-built web form. With us, sending a confirmation email is only allowed if you have taken these measures.
A spam filter is always a smart move
An outgoing spam filter always remains worthwhile. A server can be hacked or abused in other ways, and you would rather be spared that. But by putting these measures in place, you at least block one attack tactic.
Try it for free?
We can tell you all sorts of things, of course, but we can imagine you would like to see our spam filter in action. Try it for free.
Want our newsletter?
Want to stay up to date with the latest news and the most recent developments? Then follow our LinkedIn page.
