%@ LANGUAGE="VBSCRIPT"%>
<% option explicit %>
<% Response.Buffer = True %>
<%
' Declaring Variables
' If there are any new variables for a particular form they should be added here
Dim smtpserver,youremail,yourpassword,ContactUs_Name,ContactUs_Email
Dim FirstName,LastName,Name,Company,Address,City,State,ZipCode,Phone,FAX,EMail,Comments
Dim PrayerConcern
Dim ContactUs_Subject,ContactUs_Body,Action,IsError
Dim EMailSubject
' Edit these 4 values accordingly
' EMailSubject is the text that will show on the Subject line of the EMail that is sent
smtpserver = "mail.providencepres.org"
youremail = "jill@providencepres.org"
yourpassword = "1jill2"
EMailSubject = "Contact from Website"
' Grabbing variables from the form post
FirstName = Request("FirstName")
LastName = Request("LastName")
Name = Request("Name")
Company = Request("Company")
Address = Request("Address")
City = Request("City")
State = Request("State")
ZipCode = Request("ZipCode")
Phone = Request("Phone")
FAX = Request("FAX")
EMail = Request("EMail")
Comments = Request("Comments")
PrayerConcern = Request("PrayerConcern")
Action = Request("Action")
' Old variables
ContactUs_Name = Request("ContactUs_Name")
ContactUs_Email = Request("ContactUs_Email")
ContactUs_Subject = Request("ContactUs_Subject")
ContactUs_Body = Request("ContactUs_Body")
' Used to check that the email entered is in a valid format
Function IsValidEmail(Email)
Dim ValidFlag,BadFlag,atCount,atLoop,SpecialFlag,UserName,DomainName,atChr,tAry1
ValidFlag = False
If (Email <> "") And (InStr(1, Email, "@") > 0) And (InStr(1, Email, ".") > 0) Then
atCount = 0
SpecialFlag = False
For atLoop = 1 To Len(Email)
atChr = Mid(Email, atLoop, 1)
If atChr = "@" Then atCount = atCount + 1
If (atChr >= Chr(32)) And (atChr <= Chr(44)) Then SpecialFlag = True
If (atChr = Chr(47)) Or (atChr = Chr(96)) Or (atChr >= Chr(123)) Then SpecialFlag = True
If (atChr >= Chr(58)) And (atChr <= Chr(63)) Then SpecialFlag = True
If (atChr >= Chr(91)) And (atChr <= Chr(94)) Then SpecialFlag = True
Next
If (atCount = 1) And (SpecialFlag = False) Then
BadFlag = False
tAry1 = Split(Email, "@")
UserName = tAry1(0)
DomainName = tAry1(1)
If (UserName = "") Or (DomainName = "") Then BadFlag = True
If Mid(DomainName, 1, 1) = "." then BadFlag = True
If Mid(DomainName, Len(DomainName), 1) = "." then BadFlag = True
ValidFlag = True
End If
End If
If BadFlag = True Then ValidFlag = False
IsValidEmail = ValidFlag
End Function
%>
<%
' This is the part of the script that takes the form variables, checks for missing elements
' and creates the EMail message
If Action = "SendEmail" Then
' Here we quickly check/validate the information entered
' These checks could easily be improved to look for more things
If IsValidEmail(EMail) = "False" Then
IsError = "Yes"
Response.Write("You did not enter a valid email address.
")
End If
If LastName = "" Then
IsError = "Yes"
Response.Write("Please enter your name.
")
End If
'If LastName = "" Then
'IsError = "Yes"
'Response.Write("Please enter your last name.
")
'End If
'If Comments = "" Then
'IsError = "Yes"
'Response.Write("You did not enter a comment or question.
")
'End If
End If
' If there were no input errors and the action of the form is "SendEMail" we send the email off
If Action = "SendEmail" And IsError <> "Yes" Then
Dim strBody
' Here we create a nice looking html body for the email
' The variables may need to be changed depending on the particular form this code is being used for
strBody = strBody & "Name" & " : " & " " & Replace(LastName,vbCr,"
") & "
"
'strBody = strBody & "Company" & " : " & " " & Replace(Company,vbCr,"
") & "
"
'strBody = strBody & "Address" & " : " & " " & Replace(Address,vbCr,"
") & "
"
'strBody = strBody & "City" & " : " & " " & Replace(City,vbCr,"
") & "
"
'strBody = strBody & "State" & " : " & " " & Replace(State,vbCr,"
") & "
"
'strBody = strBody & "ZipCode" & " : " & " " & Replace(ZipCode,vbCr,"
") & "
"
strBody = strBody & "Name" & " : " & " " & Replace(LastName,vbCr,"
") & "
"
strBody = strBody & "Phone" & " : " & " " & Replace(Phone,vbCr,"
") & "
"
'strBody = strBody & "FAX" & " : " & " " & Replace(FAX,vbCr,"
") & "
"
strBody = strBody & "EMail" & " : " & " " & Replace(EMail,vbCr,"
") & "
"
strBody = strBody & "Comments" & " : " & " " & Replace(Comments,vbCr,"
") & "
"
strBody = strBody & "Prayer Concern" & " : " & " " & Replace(PrayerConcern,vbCr,"
") & "
"
'strBody = strBody & "Subject" & " : " & " " & Replace(ContactUs_Subject,vbCr,"
") & "
"
strBody = strBody & "
" & Replace(ContactUs_Body,vbCr,"
") & "
"
strBody = strBody & "This form was submitted at " & Now() & vbCrLf & "
"
'strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") & vbCrLf & "
"
'strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "
"
strBody = strBody & ""
Dim ObjSendMail
Set ObjSendMail = CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = youremail
ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = yourpassword
ObjSendMail.Configuration.Fields.Update
'End remote SMTP server configuration section==
ObjSendMail.To = youremail
ObjSendMail.Subject = EMailSubject
ObjSendMail.From = EMail
' we are sending a html email.. simply switch the comments around to send a text email instead
ObjSendMail.HTMLBody = strBody
'ObjSendMail.TextBody = strBody
ObjSendMail.Send
Set ObjSendMail = Nothing
' change the success messages below to say or do whatever you like
' you could do a response.redirect or offer a hyperlink somewhere.. etc etc
response.Redirect "http://www.providencepres.org/Communications/subscription confirmation.html"
%>
Your message has been sent to SpyderWeb Concepts
Someone will be in contact with you shortly
Thank You !!
<% '=Replace(ContactUs_Body,vbCr,"
") %>
<% Else %>
<% End If %>
![]() |
![]() |
|
|
|
515 Oakland Avenue | Rock Hill, South Carolina 29730 | info@providencepres.org | Phone: 803-328-6269 | Toll Free:: 800-922-1609 | Fax: 803-328-8701 Providence Presbytery © 2009
|