%@ LANGUAGE="VBScript" %>
<% '***************************************************************************
'* ASP FormMail *
'* *
'* Do not remove this notice. *
'* *
'* Copyright 1999-2002 by Mike Hall. *
'* Please see http://www.brainjar.com for documentation and terms of use. *
'***************************************************************************
' Edited by Pipex Hosting Communications Limited 2005, for use on
' Windows Shared hosting, www.webfusion.co.uk
'- Customization of the following line numbers is required,
'13
'16
'409
'410 -----------
referers = Array("www.theweddingcheesecakeco.co.uk")
mailComp = "CDOSYS"
smtpServer = "intmail.atlas.pipex.net"
fromAddr = "contact@theweddingcheesecakeco.co.uk"
Response.Buffer = true
errorMsgs = Array()
'Check for form data.
'if Request.ServerVariables("Content_Length") = 0 then
'call AddErrorMsg("No form data submitted.")
'end if
'Check if referer is allowed.
if UBound(referers) >= 1 then 'this changed from 1 bypasses firewall.
validReferer = false
referer = GetHost(Request.ServerVariables("HTTP_REFERER"))
for each host in referers
if host = referer then
validReferer = true
end if
next
if not validReferer then
if referer = "" then
call AddErrorMsg("No referer.")
else
call AddErrorMsg("Invalid referer: '" & referer & "'.")
end if
end if
end if
'Check for the recipients field.
if Request.Form("_recipients") = "" then
call AddErrorMsg("Missing email recipient.")
end if
'Check all recipient email addresses.
recipients = Split(Request.Form("_recipients"), ",")
for each name in recipients
name = Trim(name)
if not IsValidEmailAddress(name) then
call AddErrorMsg("Invalid email address in recipient list: " & name & ".")
end if
next
recipients = Join(recipients, ",")
'Get replyTo email address from specified field, if given, and check it.
name = Trim(Request.Form("_replyToField"))
if name <> "" then
replyTo = Request.Form(name)
else
replyTo = Request.Form("_replyTo")
end if
if replyTo <> "" then
if not IsValidEmailAddress(replyTo) then
call AddErrorMsg("Invalid email address in reply-to field: " & replyTo & ".")
end if
end if
'Get subject text.
subject = Request.Form("_subject")
'If required fields are specified, check for them.
if Request.Form("_requiredFields") <> "" then
required = Split(Request.Form("_requiredFields"), ",")
for each name in required
name = Trim(name)
if Left(name, 1) <> "_" and Request.Form(name) = "" then
call AddErrorMsg("Missing value for " & name)
end if
next
end if
'If a field order was given, use it. Otherwise use the order the fields were
'received in.
str = ""
if Request.Form("_fieldOrder") <> "" then
fieldOrder = Split(Request.Form("_fieldOrder"), ",")
for each name in fieldOrder
if str <> "" then
str = str & ","
end if
str = str & Trim(name)
next
fieldOrder = Split(str, ",")
else
fieldOrder = FormFieldList()
end if
'If there were no errors, build the email note and send it.
if UBound(errorMsgs) < 0 then
'Build table of form fields and values.
body = "
" & vbCrLf
for each name in fieldOrder
body = body _
& "
" _
& "
" & name & ":
" _
& "
" & Request.Form(name) & "
" _
& "
" & vbCrLf
next
body = body & "
" & vbCrLf
'Add a table for any requested environmental variables.
if Request.Form("_envars") <> "" then
body = body _
& "
" & vbCrLf _
& "
" & vbCrLf
envars = Split(Request.Form("_envars"), ",")
for each name in envars
name = Trim(name)
body = body _
& "
" _
& "
" & name & ":
" _
& "
" & Request.ServerVariables(name) & "
" _
& "
" & vbCrLf
next
body = body & "
" & vbCrLf
end if
'Send it.
str = SendMail()
if str <> "" then
AddErrorMsg(str)
end if
'Redirect if a URL was given.
if Request.Form("_redirect") <> "" then
Response.Redirect(Request.Form("_redirect"))
end if
end if %>
The John Walsh Wedding Car Co - Reconended Suppliers