<%
' #### This script Copyright (c) 2001 ASPjar.com, All Rights Reserved. NO WARRANTEE.
' #### You need CDONTS installed to be able to send mail
' #### Your sites information starts here ####
' Your Email Address - must be a valid domain or the mail will not send
sYouEmail="barbara@taieri.co.nz"
' Email Subject
EmailSubject="Someone has used the contact form"
'Error Message Color
ErrorColor="red"
' That's it! - you may now wish to customize the header and footer files to suit your site.
' ####################################################################################
Function ValidateField(sFieldvalue, sFieldtype)
ValidField = true
Select Case LCase(sFieldtype)
Case "name"
If Len(sFieldvalue) = 0 Then ValidField = False
Case "email"
If Len(sFieldvalue) < 5 Then
ValidField = False
Else
If InStr(1, sFieldvalue, "@", 1) < 2 Then
ValidField = False
Else
If InStr(1, sFieldvalue, ".", 1) < 4 Then
ValidField = False
End If
End If
End If
Case "message"
If Len(sFieldvalue) = 0 Then ValidField = False
Case "else"
ValidField = False
End Select
ValidateField = ValidField
End Function
Sub ShowForm
%>
<%
End Sub
Sub Send
sPunter = Request.Form("Name")
sPunterEmail = Request.Form("Email")
Message = Request.Form("message")
sMessage = "This is a message from " & sPunter & vbcrlf _
& vbcrlf _
& vbcrlf _
& Message & vbcrlf _
& vbcrlf _
& "Their email is: " & sPunterEmail & vbcrlf _
& vbcrlf _
& Mailout & vbcrlf _
& vbcrlf
Set objNewMail = CreateObject("CDONTS.NewMail")
objNewMail.Send sPunterEmail, sYouEmail, EmailSubject, sMessage
Set objNewMail = Nothing
End Sub
Set dictFields = Server.CreateObject("Scripting.Dictionary")
For Each Field in Request.Form
If ValidateField(Request.Form(Field), Field) = False Then
dictFields.Add LCase(Field), true
End If
Next
If Request.Form.Count <> 0 And dictFields.Count = 0 Then
%>
Your message has been
mailed...
Thank you for
contacting us. A reply will
be sent soon.
<%
Call Send
Else
ShowForm
End If
%>
Click
here to return to the
Taieri Gorge Railway |