%
Function RegExpTest(sEmail)
RegExpTest = false
Dim regEx, retVal
Set regEx = New RegExp
' Create regular expression:
regEx.Pattern ="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,3}$"
' Set pattern:
regEx.IgnoreCase = true
' Set case sensitivity.
retVal = regEx.Test(sEmail)
' Execute the search test.
If not retVal Then
exit function
End If
RegExpTest = true
End Function
if request.form("email") <> "" then
Dim emailAddress
emailAddress = request.form("email")
emailAddress = Cstr(emailAddress)
if emailAddress <> "" then
blnValidEmail = RegExpTest(emailAddress)
if blnValidEmail then
'--- old mailform script
Dim shopMail, shopBody
Set objErrMail= Server.CreateObject("CDO.Message")
With objErrMail
.From = request("email")
.To = "info@baileyitalia.co.uk"
.Subject = "Bailey Italia Web Form " & request("subject")
For x = 1 to Request.Form.Count
if Request.Form.Key (x) <> "submit" then
shopBody=shopBody & Request.Form.Key (x) & " = " & Request.Form.Item (x) & vbcrlf & vbcrlf
end if
Next
shopBody=shopBody & "This Email was sent on : " & date & " at " & time
.TextBody = Cstr("" & shopbody)
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "195.234.116.130"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Update
.Send
End With
set objErrMail = nothing
DIM custMail, custBody
Set objErrMail= Server.CreateObject("CDO.Message")
With objErrMail
.From = "info@baileyitalia.co.uk"
.To = request.form ("email")
.Subject = "Thank you "& request.form ("name")
custBody=custBody & "Thank You " & request.form("name") & vbcrlf & vbcrlf
custBody=custBody & "We have received your email and will deal with it promptly" & vbcrlf & vbcrlf
custBody=custBody & "Bailey Italia - http://www.baileyitalia.co.uk/ " & vbcrlf
.TextBody = Cstr("" & custBody)
.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "195.234.116.130"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Update
.Send
End With
set objErrMail = nothing
'--- end old mailform
else
url = request.ServerVariables("URL")
url = url & "?validate=The email address entered in the form is not valid. Please correct and press submit"
For x = 1 to Request.Form.Count
if Request.Form.Key (x) = "email" then
url = url & "&gmail=" & Request.Form.Item (x) & vbcrlf
else
url = url & "&" & Request.Form.Key (x) & "=" & Request.Form.Item (x) & vbcrlf
end if
Next
response.Redirect(url)
end if
End If
end if
%>
Bailey Italia - Home - Ice Cream Parlour & Coffee Shop - Nuttall Street, Old Trafford, Manchester