<%
Dim hideForm
Dim strBody
'see if we completed the form
If Request("sendIT") = "YES" Then
strBody = ""
Dim success
success = true
success = SendEmail(strBody, "GBS Roofing Request a Quote Form", "info@gbsroofing.com", "info@gbsroofing.com")
If success <> true then
Response.Write("
There was an error in submitting your information to our offices.
")
Else
Response.Write("
Thank you for contacting us. As soon as we receive your information, we will contact you within 24-48 hours to answer any questions you might have or set up an appointment.
")
Response.Write(strBody)
hideForm = true
End if
End If
If hideForm = True Then
Else
%>
<%
End If
Function SetChecked(checkName)
Dim isChecked
isChecked = " "
If Request(checkName) <> "" Then
isChecked = " checked"
End If
SetChecked = isChecked
End Function
Function SetCheckedEmail(checkName, checkedText)
Dim isChecked
isChecked = " "
If Request(checkName) <> "" Then
isChecked = " x " & checkedText & ""
End If
SetCheckedEmail = isChecked
End Function
Function SendEmail(strBody, subject, toEmail, fromEmail)
Dim objMail
Dim success
Dim sender
sender = ""
success = true
On Error Resume Next
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = toEmail
objMail.From = fromEmail
objMail.Subject = subject
objMail.Body = strBody
objMail.MailFormat = 0
objMail.BodyFormat = 0
objMail.Send
If Err.number <> 0 Then
success = false
end if
If success = false then
'try using another object
Dim objCDOMessage
'Initialize local variables
err.Clear
Set objCDOMessage = CreateObject("CDO.Message")
'Create and prepare CDO configuration object
Set objCDOConfig = CreateObject("CDO.Configuration")
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing")= 2
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="relay-hosting.secureserver.net" ' or internal ip
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =25
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password.
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") =""
objCDOMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") =""
objCDOMessage.Configuration.Fields.Update
objCDOMessage.From = fromEmail
objCDOMessage.To = toEmail
If sender <> "" Then
objCDOMessage.Sender = sender
End If
'objCDOMessage.CC = strCC
objCDOMessage.Subject = subject
'objCDOMessage.MDNRequested = true
'objCDOMessage.DSNOptions = 4 'successfull delivery
'If strType = "text" Then
' objCDOMessage.TextBody = strBody
'ElseIf strType = "html" Then
objCDOMessage.HTMLBody = strBody
'End If
'Send message
objCDOMessage.Send
'Release objects and clean up
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing
If err.number = 0 Then
success = True
Else
Response.Write(err.Description)
success = False
End If
end if
SendEmail = success
End Function
%>