<%
Function CheckMail(strEmail)
Dim bIsValid
bIsValid = True
'our variables
Dim objRegExp , blnValid
'create a new instance of the RegExp object , note we do not need Server.CreateObject("")
Set objRegExp = New RegExp
'this is our pattern we check .
objRegExp.Pattern = "^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
'store the result either true or false in blnValid
blnValid = objRegExp.Test(strEmail)
If blnValid Then
'display this if it is a vlid email address
'Response.Write "This is a valid email address "
bIsValid = True
Else
'display this if it is an invalid email address
'Response.Write "That email address is invalid "
bIsValid = False
End If
CheckMail = bIsValid
End Function
strName = ""
strComp_Name = ""
strEmail = ""
strSubj = ""
strBody = ""
invEmail = false
chrBody = false
strName = Request.Form("name")
strComp_Name = Request.Form("comp_name")
strEmail = Request.Form("email")
strSubj = Request.Form("subj")
strBody = strBody & "Name: " & strName & vbcrlf
strBody = strBody & "Company Name: " & strComp_Name & vbcrlf
strBody = strBody & "Contacting Regarding: " & strSubj & vbcrlf
strBody = strBody & "----------------------------------------" & vbcrlf
strBody = strBody & "Detailed Message: " & vbcrlf & Request.Form("body")
if cstr(strName) <> "" and cstr(strComp_Name) <> "" and cstr(strEmail) <> "" and cstr(strBody) <> "" then
if not CheckMail(cstr(strEmail)) Then
response.write ""
else
invEmail = true
end if
if len(Request.Form("body")) > 300 then
response.write ""
else
chrBody = true
end if
if invEmail and chrBody then
Dim objCDOMail
dim strTO
dim strFrom
dim strSubj
strTO = "info@dastech.com"
Set objCDOMail = Server.CreateObject("CDONTS.NewMail")
objCDOMail.To = strTO
objCDOMail.From = cstr(strEmail)
objCDOMail.Subject = cstr(strSubj)
objCDOMail.Body = cstr(strBody)
objCDOMail.Importance = 1
objCDOMail.Send
Set objCDOMail = Nothing
response.write ""
end if
end if
%>