<%
'Initialise objects and variables
Dim JMail, intComp, strReferer, strServer, strClientIP, strServerIP, blnSpam
Set JMail = Server.CreateObject("JMail.SMTPMail")
'Check if this page is being called from a another page on the server
strReferer = request.servervariables("HTTP_REFERER")
strServer = Replace(request.servervariables("SERVER_NAME"), "www.", "")
strClientIP = request.servervariables("REMOTE_ADDR")
strServerIP = request.servervariables("LOCAL_ADDR")
intComp = inStr(strReferer, strServer)
If intComp > 0 Then
blnSpam = False
Else
' Spam Attempt Block
blnSpam = True
End If
' This is my local SMTP server
JMail.ServerAddress = "smtp." & strServer & ":25"
' This is me....
JMail.Sender = "noreply@" & strServer
SenderName = Request.Form("name")
SenderCompany = Request.Form("company")
SenderPhone = Request.Form("telephone")
SenderEmail = Request.Form("email")
Subject = "Enquiry to TOCO Training from "+ SenderName
Recipient = "[email protected]"
SenderComments = Request.Form("Comments")
Body = "Enquiry from " & SenderName & vbCrLf & "Company " & SenderCompany & vbCrLf & "Telephone " & SenderPhone & vbCrLf & "Email Address " & SenderEmail & vbCrLf & vbCrLf & SenderComments & vbCrLf
If SenderEmail = "" Then
SenderEmail = "[email protected]"
End If
JMail.Sender = SenderEmail
JMail.Subject = Subject
JMail.AddRecipient Recipient
JMail.Body = Body
JMail.Priority = 3
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
'send mail
If NOT blnSpam Then
JMail.Execute
strResult = "Mail Sent."
Else
strResult = "Mail Not Sent."
End If
Set jmail = Nothing
alertAndRedirect
Sub alertAndRedirect()
%>
<script><!--
alert("Thank you for your enquiry. We will contact you shortly.");
location.href="../contact.html";
// -->
</script>
<%
End Sub
%>
|