<%@LANGUAGE="VBSCRIPT"%>
<%
' =======================================================================
' This script is set up to retreive form data via a POST request method.
' With a few syntax changes this could be used with a GET request method,
' all instances of "Request.Form" are replaced with "Request.Querystring"
' =======================================================================

' Create CDO server object
Dim objCDO
Set objCDO = Server.CreateObject("CDONTS.NewMail")

' Get sender e-mail address from form field "FromAddress".
objCDO.From = Request.Form("FromAddress")

' Set recipient(s). Could be pulled from hidden value in form, but more secure if hard coded.
' separate multiple recipients with a comma.
objCDO.To = "insert@your-email-adress-here.com"
objCDO.CC = "" ' optional.
objCDO.BCC = "" ' optional.

' Get e-mail subject from hidden form field "Subject".
' May also be hard coded.
objCDO.Subject = Request.Form("Subject")

' Build message body from form fields.
' Hard coded header, optional.
strMsgHeader = "Form information follows" & vbCrLf & vbCrLf

' Loop through form fields, in order, appending field name and value of each as a new line.
for i = 1 to Request.Form.Count
strMsgInfo = strMsgInfo & Request.Form.Key(i) & " - " & Request.Form.Item(i) & vbCrLf
next

' Hard coded footer, optional.
strMsgFooter = vbCrLf & "End of form information"

' Set object Body to Header + Form Field info + Footer.
objCDO.Body = strMsgHeader & strMsgInfo & strMsgFooter

' Send mail.
objCDO.Send()

' Close CDO server object.
Set objCDO = Nothing

' Redirect to thank-you page.
Response.Redirect "../thank-you.asp"
%>