%@ Language=VBScript %>
<% Option Explicit %>
<%
Dim strnospam, strnum
strnospam = request.form("nospam")
strnum = request.form("num")
if strnospam = strnum and NOT isEmpty(request.form("nospam")) Then
'The header/footer for the email.
Const strHeader = "Here are the results of the form:"
Const strFooter = "From the Wee Bee Hauling Contact Form"
Const strTo = "weebeehauling@shaw.ca"
'This information is optional
Dim strFrom, strSubject, strRedirectURL, strFromPath
strFrom = Request.Form("txtSendToEmailAddress")
if Len(strFrom) = 0 then strFrom = "weebeehauling@shaw.ca"
strSubject = Request.Form("txtEmailSubject")
if Len(strSubject) = 0 then strSubject = "Wee Bee Hauling Contact Form"
strRedirectURL = Request.Form("urlSendTo")
if Len(strRedirectURL) = 0 then strRedirectURL = "thanks.html"
strFromPath = Request.Form("urlFromPath")
if Len(strFromPath) = 0 then strFromPath = "contact.asp"
Dim strBody
strBody = strHeader & ( vbCrLf & vbCrLf )
strBody = strBody & ( "FORM: " & strFromPath & vbCrLf ) & _
( "FORM submitted at " & Now() & vbCrLf & vbCrLf )
dim ix, formElementName, formElementValue, prefix, fldName
For ix = 1 to Request.Form.Count
formElementName = Request.Form.Key(ix)
formElementValue = Request.Form.Item(ix)
' what type of field was that on the form?
prefix = Left(formElementName,3)
' and throw away prefix to get actual field name
fldName = Mid(formElementName,4)
' but change periods to spaces for readability
fldName = Replace(fldName, "."," ")
Select Case prefix
' if the prefix indicates this is a form field of interest...
Case "txt","sel","rad","cbo","lst","chk":
' if user didn't answer this question, say so...
if Len(formElementValue) = 0 then formElementValue = "UNANSWERED"
' then tack on the name of the field and the answer
strBody = strBody & (fldName & ": " & formElementValue & vbCrLf)
End Select
Next
strBody = strBody & ( vbCrLf & strFooter )
Dim objCDO
Dim objConfig
Set objCDO = Server.CreateObject("CDO.Message")
Set objConfig = Server.CreateObject("CDO.Configuration")
'Configuration:
objConfig.Fields(cdoSendUsingMethod) = cdoSendUsingPort
objConfig.Fields(cdoSMTPServer)="smtp.1and1.com"
objConfig.Fields(cdoSMTPServerPort)=25
objConfig.Fields(cdoSMTPAuthenticate)=cdoBasic
objConfig.Fields(cdoSendUserName) = "webmaster@travelbritishcolumbia.net"
objConfig.Fields(cdoSendPassword) = "asdfuyh#E&*YUH"
'Update configuration
objConfig.Fields.Update
Set objCDO.Configuration = objConfig
'Time to send the email
objCDO.To = strTo
objCDO.From = strFrom
objCDO.Subject = strSubject
objCDO.TextBody = strBody
objCDO.Send
Set objCDO = Nothing
'Send them to the page specified
Response.Redirect strRedirectURL
elseif isEmpty(request.form("nospam")) then
Response.Write "
Please return to our contact form to enter your details by clicking HERE."
else
Response.Write "
Please click back and follow the instructions for the last step."
End if
%>