Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Created January 4, 2011 14:48
Show Gist options
  • Select an option

  • Save walterdavis/764840 to your computer and use it in GitHub Desktop.

Select an option

Save walterdavis/764840 to your computer and use it in GitHub Desktop.
<%
' Website Contact Form Generator
' http://www.tele-pro.co.uk/scripts/contact_form/
' This script is free to use as long as you
' retain the credit link
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim name
Dim email
Dim telephone
Dim comment
' get posted data into variables
EmailFrom = "noreply (at) yourdomain.co.ukco."
EmailTo = "info (at) yourdomain.co.ukco."
Subject = "From the We are hiring Web Form"
name = Trim(Request.Form("name"))
email = Trim(Request.Form("email"))
telephone = Trim(Request.Form("telephone"))
comment = Trim(Request.Form("comment"))
' validation
Dim validationOK
validationOK=true
If (validationOK=false)
Then Response.Redirect("error.htm?" & EmailFrom)
' prepare email body text
Dim Body
Body = Body & "name: " & name & VbCrLf
Body = Body & "email: " & email & VbCrLf
Body = Body & "telephone: " & telephone & VbCrLf
Body = Body & "comment: " & comment & VbCrLf
' send email
Dim mail
Set mail = Server.CreateObject("CDO.message")
mail.To = EmailTo mail.From = EmailFrom mail.Subject = Subject mail.textBody = Body
mail.Send
' redirect to success page
Response.Redirect("http://www.yourdomain.co.uk/thankyou.html")
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment