
<%
function ReplaceChars(strReplace)
ReplaceChars=Replace(strReplace, "'", "''")
end function
Function isValidEmail(myEmail)
dim regEx
set regEx = New RegExp
regEx.IgnoreCase = False
regEx.Pattern = "^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"
isValidEmail = regEx.Test(myEmail)
set regEx = nothing
End Function
dim objMail, bodytext, errmsg
if request.form<> "" then
errmsg=""
if request.form("name") = "" then errmsg=errmsg&"
Please enter your name"
if request.form("email") = "" then errmsg=errmsg&"
Please enter your email address"
if not isValidEmail(request.form("email")) then errmsg=errmsg&"
The email address you entered is not valid. Please enter a valid email address"
if errmsg="" then
Set objMail = Server.CreateObject("CDO.Message")
objMail.From = replacechars(request.form("email")) &"("&replacechars(request.form("name"))&")"
objMail.To = "info@barewall.co.uk"
objMail.Subject= "Burslem Arts Enquiry:"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtprelay.hostingsystems.co.uk"
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
objMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout")= 60
objMail.Configuration.Fields.Update
bodytext="Burslem Arts, you have recieved an enquiry from " & request.Form("name") & " at " & now() & vbcrlf & vbcrlf
bodytext=bodytext & "Name:" & request.Form("name") & vbcrlf
bodytext=bodytext & "Email:" & request.Form("email") & vbcrlf
bodytext=bodytext & "Phone:" & request.Form("phone") & vbcrlf
bodytext=bodytext & "Message:" & request.Form("msg") & vbcrlf
objMail.TextBody = bodytext
objMail.Send
response.write "Your request has been sent thanks.
"
set objMail = nothing
else
response.write "
There was an error sending your information"
end if
end if
%>