%
'send contact email
Public Function sendfeedbackemail()
Dim sender, whodat, whoto, Body
sender = request("from")
whodat = request("fromemail")
whoto = "chris@thehouseofjohnson.net" %>
<% IF sender = "" then
error = "y" %>
you did not enter your name!
<% Else
Body = "Driver: " + sender + " "
END IF %>
<% IF IsValidEmail(whodat) = "False" THEN
error = "y" %>
you did not enter a valid email address!
<% ELSE
Body = Body + "Email: " + whodat + " "
END IF %>
<% IF request("license") = "" then
error = "y" %>
you did not enter your driver's license number!
<% Else
Body = Body + "DL number: " + request("license") + " "
END IF %>
<% IF request("state") = "" then
error = "y" %>
you did not enter your state!
<% Else
Body = Body + "State: " + request("state") + "
"
END IF %>
<% IF request("address1") = "" then
error = "y" %>
you did not enter your street address!
<% Else
Body = Body + "Address: " + request("address1") + " "
if request("address2") = "" THEN
response.Write ""
Else
Body = Body + "Address2: " + request("address2") + " "
END IF
END IF %>
<% IF request("city") = "" then
error = "y" %>
you did not enter your city!
<% Else
Body = Body + "City: " + request("city") + " "
END IF %>
<% IF request("zipcode") = "" then
error = "y" %>
you did not enter your zipcode!
<% Else
Body = Body + "Zipcode: " + request("zipcode") + "
"
END IF %>
<% IF request("phone") = "" then
error = "y" %>
you did not enter your phone number!
<% Else
Body = Body + "Phone: " + request("phone") + " "
END IF %>
<% IF request("emercontact") = "" then
error = "y" %>
you did not enter an emergency contact!
<% Else
Body = Body + "Emergency contact: " + request("emercontact") + " "
END IF %>
<% IF request("emercontactnum") = "" then
error = "y" %>
you did not enter your emergency contacts phone number!
<% Else
Body = Body + "Emergency contact #: " + request("emercontactnum") + "
"
END IF %>
<% IF request("carmake") = "" then
error = "y" %>
you did not enter your cars make!
<% Else
Body = Body + "Car Make: " + request("carmake") + " "
END IF %>
<% IF request("carmodel") = "" then
error = "y" %>
you did not enter your cars model!
<% Else
Body = Body + "Car model: " + request("carmodel") + " "
END IF %>
<% IF request("caryear") = "" then
error = "y" %>
you did not enter the year your car was made!
<% Else
Body = Body + "Car year: " + request("caryear") + " "
END IF %>
<% If request("carplate") = "" THEN
response.Write ""
ELSE
Body = Body + "Plate number: " + request("carplate") + " "
END IF
If request("carnumber") = "" THEN
response.Write ""
ELSE
Body = Body + "Car number: " + request("carnumber")
END IF
%>
<% IF request("eventdate") = "" then
error = "y" %>
you did not enter the date of the event!
<% Else
Body = Body + "
Event: " + request("eventdate") + " "
END IF %>
<% IF request("class") = "" then
Response.Write ""
Else
Body = Body + "Class: " + request("class") + " "
END IF %>
<% IF error = "" then
Dim objErrMail, bodyimage, bodyimagetop
bodyimage = "
"
bodyimagetop = " "
Set objErrMail= Server.CreateObject("CDO.Message")
With objErrMail
.From = whodat
.To = whoto
.Subject = "RGVPCA Event Registration"
.HTMLBody = bodyimagetop & Body & bodyimage
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.thehouseofjohnson.net"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "houseofjohnson\chris johnson"
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "CSEregion4"
.Configuration.Fields.Update
.Send
End With
Set objErrMail=Nothing
Set Body=Nothing
Set whodat=Nothing
Set whoto=Nothing
set bodytext=Nothing
set sender=Nothing
set bodyimage=Nothing
set bodyimagetop=Nothing
'Display to the user that their message was sent
%>
Your feedback was successfully sent.
<% ELSE %>
Click BACK to try again.
<% END IF %>
<%
End Function
'function to verify email address
Function IsValidEmail(emailAddress)
Dim ValidEmail, emailParts, iLoopCounter, emailChar, acceptableChars
ValidEmail = True 'set the default result to True
acceptableChars="abcdefghijklmnopqrstuvwxyz.-_@"
emailParts = Split(emailAddress, "@")
If UBound(emailParts) <> 1 Then
ValidEmail = false
Else
If Len(emailParts(0))<1 OR Len(emailParts(1))<4 Then
ValidEmail = false
End If
If Left(emailParts(0), 1)="." Then
ValidEmail = false
End If
If Right(emailParts(1), 1) = "." OR Right(emailParts(1), 2) = "." Then
ValidEmail = false
End If
If InStr(emailParts(1), ".") <= 0 Then
ValidEmail = false
End If
If InStr(emailParts(1), "_") >0 Then
ValidEmail = false
End If
End If
For iLoopCounter = 1 to Len(emailAddress)
emailChar = Lcase(Mid(emailAddress, iLoopCounter, 1))
If InStr(acceptableChars, emailChar) = 0 and Not IsNumeric(emailChar) Then
ValidEmail = false
End if
Next
If InStr(emailAddress, "..") > 0 Then
ValidEmail=false
End If
If InStr(emailAddress, "@.") > 0 Then
ValidEmail=false
End If
IsValidEmail=ValidEmail
End function
%>
<% IF request("feedback") = "y" THEN %>
<% Call sendfeedbackemail() %>
<% ELSE %>
Please fill the infomation out below. All fields marked with an (*) are required.