%
submitted = request.form("submitted")
if submitted then
strName = request.form("name")
strCompany = request.form("company")
strAddress = request.form("address")
strCity = request.form("city")
strState = request.form("state")
strZipCode = request.form("zip_code")
strPhone = request.form("phone")
strFax = request.form("Fax")
strEmail = request.form("email")
strPurchaseDate = request.form("expected_purchase_date")
strLength = request.form("length")
strWidth = request.form("width")
strHeight = request.form("heigth")
strTempRange = request.form("temperature_range")
strCustTempRange = request.form("custom_temp_range")
strTempControl = request.form("temperature_control_stability")
strNotes = request.form("notes")
For numIndex = 1 to Request.Form.Count
strFieldName = Request.Form.key(numIndex)
strFieldValue = Request.Form.Item(numIndex)
If strFieldName <> "expected_purchase_date" And strFieldName <> "custom_temp_range" And strFieldName <> "length" And strFieldName <> "width" And strFieldName <> "height" And strFieldName <> "notes" Then
If strFieldValue = "" Then
strErrors = strErrors & replace(strFieldName,"_"," ") & " is required.
"
ElseIf strFieldName = "email" then
if Not ValidEmail(strFieldValue) then
strErrors = strErrors & "Invalid email address.
"
end if
End If
End If
Next
if lcase(strTempRange) = "custom range room" then
strTempRange = strCustTempRange
end if
if len(strErrors) <= 0 then
strBody = vbNewLine & _
"Name=" & strName & vbNewLine & vbNewLine & _
"Company=" & strCompany & vbNewLine & vbNewLine & _
"Address=" & strAddress & vbNewLine & vbNewLine & _
"City=" & strCity & vbNewLine & vbNewLine & _
"Zip Code=" & strZipCode & vbNewLine & vbNewLine & _
"Phone=" & strPhone & vbNewLine & vbNewLine & _
"Fax=" & strFax & vbNewLine & vbNewLine & _
"E-mail=" & strEmail & vbNewLine & vbNewLine & _
"Expected Purchase Date=" & strPurchaseDate & vbNewLine & vbNewLine & _
"Length=" & strLength & vbNewLine & vbNewLine & _
"Width=" & strWidth & vbNewLine & vbNewLine & _
"Height=" & strHeight & vbNewLine & vbNewLine & _
"Temperature Range=" & strTempRange & vbNewLine & vbNewLine & _
"Temperature Control Stability=" & strTempControl & vbNewLine & vbNewLine & _
"Additional Notes=" & strNotes & vbNewLine
Call SendMailCDONTS("sales@thermmax.com", "Request Quote Form", strBody, "info@thermmax.com")
response.redirect ("thanks.html")
end if
end if
Public Function ValidEmail(value)
If IsNull(value) = False Then
ValidEmail = Len(RegExpTest((value), "^(?:[0-9A-Z_-]+(?:\.[0-9A-Z_-]+)*@[0-9A-Z-]+(?:\.[0-9A-Z-]+)*(?:\.[A-Z]{2,4}))$", True, True)) > 0
Else
ValidEmail = False
End If
End Function
Public Function RegExpTest(value, strPattern, flgIgnoreCase, flgGlobal)
Dim strMatchResult
Dim objRegExp
Dim objMatch
Dim objMatches
Set objRegExp = New RegExp
objRegExp.Pattern = strPattern
objRegExp.IgnoreCase = flgIgnoreCase
objRegExp.Global = flgGlobal
Set objMatches = objRegExp.Execute(value)
For Each objMatch In objMatches
If Len(strMatchResult) > 0 Then
strMatchResult = strMatchResult & ", "
End If
strMatchResult = strMatchResult & "" & objMatch.value & ""
Next
RegExpTest = strMatchResult
Set objMatch = Nothing
Set objMatches = Nothing
Set objRegExp = Nothing
End Function
Sub SendMailCDONTS(aTo, Subject, TextBody, aFrom)
Const CdoBodyFormatText = 1
Const CdoBodyFormatHTML = 0
Const CdoMailFormatMime = 0
Const CdoMailFormatText = 1
Dim Message 'As New cdonts.NewMail
'Create CDO message object
Set Message = CreateObject("cdonts.NewMail")
With Message
'Set email adress, subject And body
.To = aTo
.Subject = Subject
.Body = TextBody
'set mail And body format
.MailFormat = CdoMailFormatText
.BodyFormat = CdoBodyFormatText
'Set sender address If specified.
If Len(aFrom) > 0 Then .From = aFrom
'Send the message
.Send
End With
End Sub
%>