Email injection: How I protected my web site against a SPAM attack

Some of you may have detected like one visitor (who left a message in the comment zone of an article) that the contact page was no longer working. It was a quick and dirty solution to protect us against a spammer trying to (and succeeding to) use my contact page to send email to another destination than the one originally intended. It’s know as an email injection attack.

I had to insert a protection code inspired from the one proposed by Christian Lescuyer on his web site.

If, despite my attention and my tests, you notice something fishy or not working, please, send me a short message (writing directly to my bad_email roumazeilles.net.