Adding few lines of code will kick out the spammer by detecting that the URL of the referrer is not the URL of the form.
1 2 3 4 5 | import os
FormURL = 'http://example.tld/contact.html'
...
if os.environ['HTTP_REFERER'] != FormURL: return
|
Spammers highjack your contact form to automatically submit automated messages through your email script. This code will prevent that.
Tags: web