%
Response.Buffer = True
' create db connection and query string
Set connTemp = Server.CreateObject ("Adodb.Connection")
connTemp.Open strConn
Dim m_name,m_phone,m_fax,m_email,m_comments,m_company
Dim m_strMainPrompt,m_Network,m_IntConnect,m_Promo
If (Request.Form("hdnSendMail") <> "") Then
m_Name = Request.Form("name")
m_phoneNumber = Request.Form("PhoneNumber")
m_email = Request.Form("email")
m_Address = Request.Form("Address")
m_City = Request.Form("City")
m_State = Request.Form("State")
m_Zip = Request.Form("Zip")
m_comments = Request.Form("comments")
m_preferred = Request.Form("preferred")
ProcessPage()
end if
%>
Oliver Homes: Contact
<%
' Examines the form and creates a new account if the fields look valid.
' Redirects back to the login page if successful.
Sub ProcessPage
'Check to see that user filled out form correctly
If IsFormValid = true Then
'SendEmail returns a 1 if the transaction completed and a 0 if the transaction failed
If SendEmail = 1 Then
Response.Redirect("ContactConfirm.asp")
End If
End If
End Sub
' Perform server-side validation on the fields before they're passed to
' the middle-tier. It would be possible to insert a call here to some
' business logic to see if the e-mail account is already in use.
Function IsFormValid
IsFormValid = true
If Trim(m_name) = "" then
IsFormValid = false
m_strMainPrompt = "" & "Please input a name." & ""
end if
If (Trim(m_email) = "") and (Trim(m_phone) = "") then
IsFormValid = false
m_strMainPrompt = m_strMainPrompt & " " & "Please input an email address or telephone number." & ""
end if
If m_email <> "" then
if ValidateEmail(m_email) then
IsFormValid = false
m_strMainPrompt = m_strMainPrompt & " " & "Please input a valid email address." & ""
end if
end if
End Function
Function SendEmail
' On Error Resume Next
SendEmail = 0 ' assume it fails
' create an instance of the MailASP object
Set Mailer = Server.CreateObject ("SMTPsvg.Mailer")
Mailer.FromName = "Strategic Hosting Services"
Mailer.FromAddress = "hosting@strategiccorp.com"
'Mailer.RemoteHost = "mail.strategiccorp.com"
Mailer.RemoteHost = "127.0.0.1"
Mailer.AddRecipient "Oliver Homes", "sales@oliverhomesllc.com"
'Mailer.AddRecipient "Oliver Homes", "dbuchanan@strategiccorp.com"
Mailer.AddBCC "Oliver Homes", "dbuchanan@strategiccorp.com"
Mailer.Subject = "Contact us"
' create string for message body
strMsg = "Name: " & m_name & vbCRLf
strMsg = strMsg & vbCRLf
strMsg = strMsg & "Address: " & m_Address & vbCRLf
strMsg = strMsg & "City: " & m_City & vbCRLf
strMsg = strMsg & "State/ZipCode: " & m_State & " " & m_Zip & vbCRLf
strMsg = strMsg & "Phone: " & m_phoneNumber & vbCRLf
strMsg = strMsg & "Email: " & m_email & vbCRLf
strMsg = strMsg & "Preferred method of contact: " & m_email & vbCRLf
strMsg = strMsg & vbCRLf
strMsg = strMsg & "Comments: " & m_comments & vbCRLf & vbCRLf & vbCRLf & vbCRLf
strMsg = strMsg & "PLEASE DO NOT REPLY TO THIS MESSAGE - It is an automatically generated message generated by your web site" & vbCRLf & vbCRLf
Mailer.BodyText = strMsg
' send message and check for users
If not Mailer.SendMail Then
Response.Write "
"
Response.Write "An error was encountered. Error was " & Mailer.Response
Response.Write "