<%
'ASP code will determine if the form was submitted.
if request.Form("IsPostBack") = "posted" then
'Routine to send the form information. Found after
'HTML form.
call SendFormMail()
'Options for after the form is submitted.
'
'*********************************************************
'Option 1) '*
'If you wish to have no pop-up window and have the '*
'message be display on the same page un-comment the '*
'call ThankYou() line and comment out the '*
'call RedirectPage() line. Also in the '*
'jsFormValidater.js file comment out the line in the '*
'FormValidate function that start out window.open by '*
'placeing 2 forward slashes, (//) in front of it. '*
' '*
'Routine to display editable thank you message. Found '*
'after the SendFormMail routine. '*
call ThankYou()
'*********************************************************
'Option 2)
'If you wish to have the pop-up window and redirect the '*
'page un-comment the call RedirectPage() line and also '*
'un-comment the window.open line in the '*
'jsFormValidater.js file in the FormValidate function. '*
'Then comment out the call ThankYou() line. '*
'*********************************************************
' '*
'Routine to redirect the page to some other location. '*
'call RedirectPage()
'*********************************************************
else
dim arrPostLocation 'Will become array object
dim PostLocation 'Assigned page this code is inserted to.
'Gets the page that this file is instered to so that we get
'correct post back and avoid error with losing the page where
'the form is to be posted to.
arrPostLocation = split(request.ServerVariables("URL"), "/")
'arrPostLocation is split apart at each forward slash.
'Since the page that this code is inserted to is the
'last element in the array, but we have no idea how
'many elements there are we determine the last element
'in the array with the ubound function. This will
'return the page we need for the form action.
PostLocation = arrPostLocation(ubound(arrPostLocation))
%>
<%
'************************************************************************
'* Information about the form template *
'* *
'* 1) If a form tag is to be required indicate it by typing *
'* "required" in for the id property of the tag. *
'* *
'* 2) Form tags that will deal with information such that of email, *
'* phone, and zipcode MUST have either phone, email or zipcode *
'* within the name property of the tag ie (txtEmail, email, *
'* txtPhone, FaxPhone). This is for proper validation of the *
'* elements. *
'************************************************************************
%>
<%
end if
%>
<%
sub SendFormMail()
dim oMail 'Mail object
dim sTo 'Editable variable to send form to.
dim sFrom 'Users email address
dim sCC 'Used to add additional emails
dim sBCC 'Used to add additional emails
dim sSubject 'Editable subject of email.
dim sMessage 'Form data will be placed in variable.
'Initialize the Mail object variable.
set oMail = server.CreateObject("CDO.Message")
'Initialize the variables here
sTo = "bbcmidd@sunlink.net"
sCC = ""
sBCC = ""
sSubject = "Beavertown Block Estimator"
'***************************************************
'NOTE: Place the name of the forms element that '*
' you have set as the primary email between '*
' the double quotes. '*
'****************************************************
if trim(request.Form("txtEmail")) <> "" then
sFrom = request.Form("txtEmail")
else
sFrom = "requestinfo@beavertownblock.com" ' Place replacement email between quotes
end if
'****************************************************
'************************************
'DO NOT CHANGE THIS VARIABLE HERE! '*
'************************************
sMessage = ""
'************************************
with oMail
.to = sTo
.from = sFrom
.subject = sSubject
'Determine if CC and/or BCC are being used.
if len(trim(sCC)) <> 0 then
.cc = sCC
end if
if len(trim(sBCC)) <> 0 then
.bcc = sBCC
end if
'**********************************************************************
'NOTE: '*
'The following code will place the form data into the message '*
'in the followng format. '*
' '*
'FormElementName=Value&FormElementName=Value '*
'ie. txtEmail=someone@domain.com&txtFirstName=someone '*
' '*
'If you wish to make the message more readable comment the following '*
'code out and use the code that is commented out after it following '*
'instructions. '*
'**********************************************************************
'sMessage = request.Form
'**********************************************************************
'**********************************************************************
'Simply copy and paste the code below that is commented out and '*
'replace the words in the double quotes. '*
'READABLE IDENTIFIER = Something like First Name, Last Name, etc. '*
'FORM_ELEMENT = The name property of a form element tag. '*
' '*
'A side note vbcrlf stands for carriage return line feed so the the '*
'next value that you would assign is placed on the following line. '*
'**********************************************************************
sMessage = sMessage & "Name: " & request.Form("Name") & vbcrlf
sMessage = sMessage & "Company: " & request.Form("Company") & vbcrlf
sMessage = sMessage & "Address: " & request.Form("Address") & vbcrlf
sMessage = sMessage & "City: " & request.Form("City") & vbcrlf
sMessage = sMessage & "State: " & request.Form("State") & vbcrlf
sMessage = sMessage & "Country: " & request.Form("Country") & vbcrlf
sMessage = sMessage & "Zipcode: " & request.Form("Zipcode") & vbcrlf
sMessage = sMessage & "Phone: " & request.Form("Phone") & vbcrlf
sMessage = sMessage & "Fax: " & request.Form("Fax") & vbcrlf
sMessage = sMessage & "Email: " & request.Form("Email") & vbcrlf
sMessage = sMessage & "75th Anniversary Brochure: " & request.Form("BeavertownBlockCoIncs75thAnniversary") & vbcrlf
sMessage = sMessage & "Specification Data: " & request.Form("SpecificationData") & vbcrlf
sMessage = sMessage & "Architectural CMUs: " & request.Form("ArchitecturalConcreteMasonryUnit") & vbcrlf
sMessage = sMessage & "A Block: " & request.Form("ABlock") & vbcrlf
sMessage = sMessage & "Radial Block: " & request.Form("RadialBlock") & vbcrlf
sMessage = sMessage & "Smart Space: " & request.Form("SmartSpace") & vbcrlf
sMessage = sMessage & "Burnished Concrete Masonry Unit: " & request.Form("BurnishedConcreteMasonryUnit") & vbcrlf
sMessage = sMessage & "Sound Cell: " & request.Form("SoundCell") & vbcrlf
sMessage = sMessage & "CMU Foundations: " & request.Form("ConcreteMasonryUnitFoundations") & vbcrlf
sMessage = sMessage & "Wallstone: " & request.Form("Wallstone") & vbcrlf
sMessage = sMessage & "Radial Block Retaining Walls: " & request.Form("RadialBlockRetainingWalls") & vbcrlf
sMessage = sMessage & "Concrete Pavers: " & request.Form("ConcretePavers") & vbcrlf
sMessage = sMessage & "Hard Scapes: " & request.Form("HardScapes") & vbcrlf
sMessage = sMessage & "Wedgestone: " & request.Form("Wedgestone") & vbcrlf
sMessage = sMessage & "Accessories: " & request.Form("Accessories") & vbcrlf
sMessage = sMessage & "Korfil: " & request.Form("Korfil") & vbcrlf
sMessage = sMessage & "DUR-O-WAL: " & request.Form("DUROWAL") & vbcrlf
sMessage = sMessage & "Shotblasted: " & request.Form("Shotblasted") & vbcrlf
sMessage = sMessage & "Rockwood: " & request.Form("Rockwood") & vbcrlf
sMessage = sMessage & "Other: " & request.Form("Other") & vbcrlf
sMessage = sMessage & "Contact me: " & request.Form("CONTACTMEYES2") & vbcrlf
sMessage = sMessage & "" & request.Form("CONTACTMENO2") & vbcrlf
'**********************************************************************
'Assign the message string to the body of the email to be sent.
.textbody = sMessage
end with
'Send the email.
oMail.send
'Destroy the mail object
set oMail = nothing
end sub
sub ThankYou()
dim sMessage 'Editable thank you message.
'*******************************************************************
'Place whatever message you want between the double quotes. '*
'PLEASE NOTE: If you place double quote in the sting please '*
' refer to the example provided. Basically '*
' whatever you would be doube quoting place two '*
' double quotes at the being and two at the end. '*
' '*
'"something in double quotes with ""double quotes""." '*
' '*
'One more note you may place html tags in the string as well just '*
'keep in mind about the double quotes. '*
'*******************************************************************
sMessage = " Thank You for your request. You will receive your brochures in the mail shortly. "
response.Write(sMessage)
end sub
sub RedirectPage()
dim sRedirect
'Place the page you want to redirect the browser
'to between the double quotes.
sRedirect = "index.asp"
response.Redirect(sRedirect)
end sub
%>
|