%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
OPTION EXPLICIT ' declare all variables
dim Mail, txtBody, i, error_found
error_found = "false"
'Set the server locale
Session.LCID = 2057
function chkEmail(theAddress)
' checks for a vaild email
' returns 1 for invalid addresses
' returns 0 for valid addresses
dim atCnt, i
chkEmail = 0
' chk length
if len(theAddress) < 5 then
' a@b.c should be the shortest an
' address could be
chkEmail = 1
' chk format
' has at least one "@"
elseif instr(theAddress,"@") = 0 then
chkEmail = 1
' has at least one "."
elseif instr(theAddress,".") = 0 then
chkEmail = 1
' has no more than 3 chars after last "."
elseif len(theAddress) - instrrev(theAddress,".") > 3 then
chkEmail = 1
' has no "_" after the "@"
elseif instr(theAddress,"_") <> 0 and _
instrrev(theAddress,"_") > instrrev(theAddress,"@") then
chkEmail = 1
else
' has only one "@"
atCnt = 0
for i = 1 to len(theAddress)
if mid(theAddress,i,1) = "@" then
atCnt = atCnt + 1
end if
next
if atCnt > 1 then
chkEmail = 1
end if
' chk each char for validity
for i = 1 to len(theAddress)
if not isnumeric(mid(theAddress,i,1)) and _
(lcase(mid(theAddress,i,1)) < "a" or _
lcase(mid(theAddress,i,1)) > "z") and _
mid(theAddress,i,1) <> "_" and _
mid(theAddress,i,1) <> "." and _
mid(theAddress,i,1) <> "@" and _
mid(theAddress,i,1) <> "-" then
chkEmail = 1
end if
next
end if
end function
if request("action") = "send" then
txtBody = "The following enquiry was submitted at " & now() & vbcrlf &_
vbcrlf &_
"SENDER DETAILS" & vbcrlf &_
"----------------" & vbcrlf &_
vbcrlf &_
"Name: " & request("senderName") & vbcrlf &_
"Email Address: " & request("emailAddress") & vbcrlf &_
"Enquiry About: " & request("enqAbout") & vbcrlf &_
vbcrlf &_
"ENQUIRY" & vbcrlf &_
"------------------" & vbcrlf &_
vbcrlf &_
request("enquiry") & vbcrlf
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtpmail.databasepower.net" ' Specify a valid SMTP server
' Specify sender's address
if chkEmail(request("emailAddress")) = 0 then
Mail.From = request("emailAddress")
else
Mail.From = "enquiry@elite-entertainment.co.uk"
end if
Mail.FromName = request("senderName") ' Specify sender's name
'Mail.AddAddress "andytheegg@yahoo.co.uk"
Mail.AddAddress "paul@elite-entertainment.co.uk"
Mail.Subject = "ENQUIRY - Posted from Elite Drinks"
Mail.Body = txtBody
Mail.Send
end if
%>
Elite Drinks Distribution
Quick Contact Form
<%if request("action") = "send" then%>
Thank You
Your enquiry has been sent.
We will reply as soon as possible.