shanoinsano
Technical User
I am a Graphic Designer / Web Designer and am designing a HTML Contact Form using ASP / CDO.Message for processing & sending...
I have successfully implemented ASP CDO.Message Email Script, Required Fields Validation via the ASP Email Script and Client Side Email Address Validation Javascript...
..problem is, I am having no success adding ASP Server Side Email Validation and ASP Captcha :-|
ASP Email Script using CDO.Message:
I would like to incorporate this into above script...
Server Side validation Script:
...as well as this but not as a separate HTML Page (all inclusive to ASP Email Script at top)
Captcha Script:
Any Help, Suggestions very much appreciated.
Cheers
-----
Shano Insano
Always ready to tell a fictitious story,
dispense bad advice or lend an inexpert hand...
I have successfully implemented ASP CDO.Message Email Script, Required Fields Validation via the ASP Email Script and Client Side Email Address Validation Javascript...
..problem is, I am having no success adding ASP Server Side Email Validation and ASP Captcha :-|
ASP Email Script using CDO.Message:
Code:
<%
Dim strName, strEmail, strSubject, strComment
strName = Trim(Request.Form("First"))
strEmail = Trim(Request.Form("Email"))
strSubject = Trim(Request.Form("Subject"))
strComment = Trim(Request.Form("Comment"))
Dim strMessage
strMessage=strMessage &"Title: " & Request.Form("Title") & VbCrLf
strMessage=strMessage &"First Name: " & Request.Form("First") & VbCrLf
strMessage=strMessage &"Last Name: " & Request.Form("Last") & VbCrLf
strMessage=strMessage &"Business Address: " & Request.Form("Business") & VbCrLf
strMessage=strMessage &"Residential Address: " & Request.Form("Residential") & VbCrLf
strMessage=strMessage &"PO Box: " & Request.Form("POBox") & VbCrLf
strMessage=strMessage &"Work Phone: " & Request.Form("Work") & VbCrLf
strMessage=strMessage &"Home Phone: " & Request.Form("Home") & VbCrLf
strMessage=strMessage &"Mobile Phone: " & Request.Form("Mobile") & VbCrLf
strMessage=strMessage &"Comment: " & Request.Form("Comment") & VbCrLf
IF strName <> "" AND strSubject <> "" AND strComment <> "" AND strEmail <> "" THEN
Set objMail = CreateObject("CDO.Message")
objMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/sendusing")[/URL] = 2
objMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserver")[/URL] = "mail.host.com"
objMail.Configuration.Fields.Item ("[URL unfurl="true"]http://schemas.microsoft.com/cdo/configuration/smtpserverport")[/URL] = 25
objMail.Configuration.Fields.Update
objMail.From = strEmail
objMail.To = "me@email.com"
objMail.Subject = strSubject
objMail.TextBody = strMessage
objMail.Send
ELSE
Response.Redirect("error.htm")
END IF
Set objMail = Nothing
Response.Redirect("thankyou.htm")
%>
I would like to incorporate this into above script...
Server Side validation Script:
Code:
set DNSobject = Server.CreateObject("CompanyABC.DNS")
emailaddress = Request.Form("emailaddress")
thedomainname =Mid(emailaddress,InStr(1,emailaddress,"@",vbTextCompare)+1,Len(emailaddress))
DNSobject.domain = thedomainname
DNSobject.server = "XXX.XXX.XXX.XXX"
goodorbad = DNSojbect.dolookup
If goodorbad = "" Then 'Keep in mind some DNS object may return something other than ""
Response.Redirect("badaddress.html")
Else
<continue form processing>
End If
...as well as this but not as a separate HTML Page (all inclusive to ASP Email Script at top)
Captcha Script:
Code:
<%
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
%>
<%
Function CheckCAPTCHA(valCAPTCHA)
SessionCAPTCHA = Trim(Session("CAPTCHA"))
Session("CAPTCHA") = vbNullString
if Len(SessionCAPTCHA) < 1 then
CheckCAPTCHA = False
exit function
end if
if CStr(SessionCAPTCHA) = CStr(valCAPTCHA) then
CheckCAPTCHA = True
else
CheckCAPTCHA = False
end if
End Function
%>
<html>
<head>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title></title>
</head>
<body>
<!-- Some layout HTML stripped out for length -->
<form id="f_example" name="f_example" method="post" action="example.asp">
<img src="aspcaptcha.asp" alt="This Is CAPTCHA Image" width="86" height="21" />
<%
if Request.ServerVariables("REQUEST_METHOD") = "POST" then
strCAPTCHA = Trim(Request.Form("strCAPTCHA"))
if CheckCAPTCHA(strCAPTCHA) = true then
%>
Verified (<%=strCAPTCHA%>)
<%
else
%>
Not Verified. Please Retry.
<%
end if
end if
%>
<input name="strCAPTCHA" type="text" id="strCAPTCHA" maxlength="8" />
<input type="submit" name="Submit" value="Test Input" />
</form>
</body>
</html>
Any Help, Suggestions very much appreciated.
Cheers
-----
Shano Insano
Always ready to tell a fictitious story,
dispense bad advice or lend an inexpert hand...