A simple contact form for your website
It has to be said - email is probably the most revoluntionary form of communication, with SMS running a close second, the abilty to be able to rapidly communicate with almost anyone anywhere, virtually free has led to the development of spam. The easiest way to combat this is to use a contact form on your website, unfortunately the same robots that spider websites for email addresses also look for contact forms to abuse to send spam.
If you put in a contact form on UsableHost - it MUST have the contact email address hard coded into it. We unfortunately also have had to reccomend 'captcha' scripts to stop robots trying, and flooding your in box with odd messages. The comments can be removed.
Below is an example script using CDOSYS which is installed on our servers:
<% if request("captcha") = "YOURCODE" then
'Should the captcha code be wrong redirect them somewhere and don't process the scriptsSet myMail=CreateObject("CDO.Message")
' the subject line can be dynamic, useful for filtering, use request("your form field name") instead of setting it within speech marks
myMail.Subject="YOUR SUBJECT HERE"
'there is no validation that it is an email address at present, this should be inserted, or the from address hard coded
myMail.From = "Contact@YOURDOMAIN"
myMail.To="YOUR EMAIL ADDRESS HERE"
myMail.Bcc="ALTERNATE EMAIL HERE"'To be lazy and to allow it to be used for complex forms we wanted it to loop through and put all values into the email body that are in the form
For Each x In Request.Form
message = message & x & ": " & Request.Form(x) & CHR(10)
Next'Send and clean up
myMail.TextBody=message
myMail.Send
set myMail=nothing'Redirect somewhere nice (or altnernatively put the page in here - I use redirection as I like to keep my scripts seperate
response.Redirect("/thanks.asp")
else
response.Redirect("/nocaptcha.asp")
end if
%>
This can be combine with a simple form - you can make it up out of radio buttons, text fields - in fact most standard form elements - EXCEPT for uploading files.
As this uses a static captch (not a randomly created one - its not quite robot proof, however it should be 99% for the present. We have tried out many different captcha systems on a variety of websites and most of them work (including this one).
Further information
- We have used Cdosys, purely as its installed on all our servers (regardless of the client) we do have others installed on our general hosting - these are better suited when you want further control such as html formatted mail, bulk (for newsletters that have been EXPLICITLY subscribed to)
- If anyone on our hosting is accused of spam we will investigate immediately, in the UK it is illegal to spam with fines of upto £10,000 per mail.
- This script can be combined with a domain test - to further reduced spam.
if Request.ServerVariables("HTTP_HOST") = "www.UsableHost.co.uk" then
PUT SCRIPT HERE
end if


