The views expressed on this website/web log are mine alone
and do not necessarily reflect the views of others
Authors Profile
located in Mumbai, Shalini Aggarwal has interest in
astrology, numerology, Namology, travelling and finance.
recent posts
my trip to Kerala
pictures of Kerala trip
submit your comments
<%
mailHost = "mail.sunrisevilla.in"
showRating = true
thankYouMessage = "Thank you %name% for filling in the form! Your submission below has been sent to our web admin:
%message%
"
errorMessage = "Sorry, your submission had errors"
adminEmailAddress = "astro@sunrisevilla.in"
%>
<%
function clearUnSafeTags(s)
dim re
Set re = New RegExp
're.Pattern = "(<( )*\/{0,1}( )*(?!b|i|u|p|a|ul|li|ol)[^>]*>)"
re.Pattern = "<(?!b>|\/b>|br>|li>|\/li>|i>|\/i>|u>|\/u>)[^>]*>"
re.Global = true
re.IgnoreCase = true
clearUnSafeTags = re.replace(s, "")
end function
function IsEmail(strEmail)
Dim strTemp
strEmail = CStr(strEmail)
IsEmail = false
if not InStr(strEmail, "@") > 0 then
exit function
end if
if not InStr(strEmail, ".") > 0 then
exit function
end if
if not Len(Left(strEmail, Instr(strEmail, "@") - 1)) => 3 then
exit function
end if
strTemp = Mid(strEmail, InStr(strEmail, "@") + 1, Len(strEmail))
if not Len(Left(strTemp, InStr(strTemp, ".") - 1)) => 3 then
exit function
end if
if not Len(Right(strTemp, Len(strTemp) - Instr(strTemp, "."))) => 2 then
exit function
end if
IsEmail = true
end function
%>
<%
If Request("submit") <> "" Then
dim errors(4)
errored = false
if request("name") = "" then
errors(0) = "Please enter your name"
errored = true
end if
if request("email") = "" then
errors(1) = "Please enter your email address"
errored = true
end if
if request("email") <> "" and not IsEmail(request("email")) then
errors(1) = "Your email address appears to be invalid"
errored = true
end if
if request("subject") = "" then
errors(2) = "Please enter a subject"
errored = true
end if
if request("message") = "" then
errors(3) = "Please enter a message"
errored = true
end if
if not errored then
Set Mail = Server.CreateObject("CDO.Message")
Set Conf = Server.CreateObject("CDO.Configuration")
sConfURL = "http://schemas.microsoft.com/cdo/configuration/"
with conf
.Fields.Item(sConfURL & "sendusing") = 2
.Fields.Item(sConfURL & "smtpserver") = mailHost
.Fields.Item(sConfURL & "smtpserverport") = 25
.Fields.Update
end with
message = replace(request("message"), VbCrLf, " ")
message = clearUnSafeTags(message)
subject = clearUnSafeTags(request("subject"))
name = clearUnSafeTags(request("name"))
email = clearUnSafeTags(request("email"))
emailHtml = "
"
emailHtml = emailHtml & "
The following submission was made on the " & date & " at " & time & "
"
Mail.From = email
Mail.To = adminEmailAddress
Mail.Subject = subject
Mail.HTMLBody = emailHtml
success = false
On Error Resume Next
mail.configuration = conf
Mail.Send
Set Conf = Nothing
Set Mail = Nothing
if Err <> 0 then
errors(4) = Err.Description
errored = true
else
success = true
end if
end if
end if
if success then
thankYouMessage = Replace(thankYouMessage, "%name%", name)
thankYouMessage = Replace(thankYouMessage, "%email%", email)
thankYouMessage = Replace(thankYouMessage, "%subject%", subject)
thankYouMessage = Replace(thankYouMessage, "%message%", message)
response.write(thankYouMessage)
else
if errored then
response.write("
")
response.write(errorMessage)
response.write("
")
for i = lbound(errors) to ubound(errors)
if errors(i) <> "" then
response.write("
" & errors(i) & "
")
end if
next
response.write("
")
response.write("
")
end if
%>
If found relevant and useful we will publish the same in our blog