<%@ Language=VBScript %> <% option explicit %> <% Response.Buffer = True %> <% 'Declaring Variables Dim smtpserver,youremail,yourpassword,ContactUs_FirstName,ContactUs_LastName,ContactUs_Email Dim ContactUs_PhoneNumber,ContactUs_BestTime,ContactUs_FaxNumber,ContactUs_CurrentAdd1,ContactUs_CurrentAdd2,ContactUs_PropertyAdd1,ContactUs_PropertyAdd2,ContactUs_Comments Dim ContactUs_Subject,ContactUs_Body,Action,IsError dim sNeeds ' Edit these 3 values accordingly.. leave the smtp server alone as it is set for Gmail smtpserver = "smtp.gmail.com" youremail = "wpinsurancect@gmail.com" yourpassword = "wpinssrvcct" 'youremail = "johnschearer@gmail.com" 'yourpassword = "rogue6" ' Grabbing variables from the form post ContactUs_FirstName = Request("FirstName") ContactUs_LastName = Request("LastName") ContactUs_Email = Request("E-MailAddress") ContactUs_PhoneNumber = Request.Form("PhoneNumber") ContactUs_BestTime = Request("BestTime") ContactUs_FaxNumber = Request("FaxNumber") ContactUs_CurrentAdd1 = Request("CurrentAdd1") ContactUs_CurrentAdd2 = Request("CurrentAdd2") ContactUs_PropertyAdd1 = Request("PropertyAdd1") ContactUs_PropertyAdd2 = Request("PropertyAdd2") ContactUs_Comments = Request("Comments") ContactUs_Subject = "Request for a Quote" ContactUs_Body = Request("ContactUs_Body") Action = Request("Action") sNeeds = "" if len(Request.Form("chkhomeowners")) > 0 then sNeeds = sNeeds + "Homeowners
" end if if len(Request.Form("chkLife") ) > 0 then sNeeds = sNeeds + "Life
" end if if len(Request.Form("chkLongTermCare") ) > 0 then sNeeds = sNeeds + "Long-Term Care
" end if if len(Request.Form("chkAutomobile") ) > 0 then sNeeds = sNeeds + "Automobile
" end if if len(Request.Form("chkHealth") ) > 0 then sNeeds = sNeeds + "Health
" end if if len(Request.Form("chkValuableArticles") ) > 0 then sNeeds = sNeeds + "Valuable Articles
" end if if len(Request.Form("chkUmbrella") ) > 0 then sNeeds = sNeeds + "Umbrella/Excess Liability
" end if if len(Request.Form("chkFlood") ) > 0 then sNeeds = sNeeds + "Flood
" end if if len(Request.Form("chkYacht") ) > 0 then sNeeds = sNeeds + "Yacht
" end if if len(Request.Form("chkCondo") ) > 0 then sNeeds = sNeeds + "Condominium/Renters
" end if if len(Request.Form("chkDisability") ) > 0 then sNeeds = sNeeds + "Disability
" end if ' 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 %> Request a Quote From William Pitt Insurance Services

Office Hours Monday - Friday
9:00am - 5:00pm

<% 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(ContactUs_Email) = "False" Then IsError = "Yes" Response.Write("You did not enter a valid email address.
") 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 strBody = ContactUs_FirstName + " " + ContactUs_LastName + " has requested a quote." + _ "
Their contact information is as follows:

" + _ "Client First Name: " + ContactUs_FirstName + "
" + _ "Client Last Name: " + ContactUs_LastName + "
" + _ "Client E-Mail Address: " + ContactUs_Email + "
" + _ "Client Phone Number: " + ContactUs_PhoneNumber + "
" + _ "Best Time to Call: " + ContactUs_BestTime + "
" + _ "Fax: " + ContactUs_FaxNumber + "
" + _ "Current Address: " + ContactUs_CurrentAdd1 + "
" + _ "Current Town, City & ZipCode: " + ContactUs_CurrentAdd2 + "
" + _ "Property Address: " + ContactUs_PropertyAdd1 + "
" + _ "Property Town, City & ZipCode: " + ContactUs_PropertyAdd2 + "
" + _ "Insurance Needs:
" + sNeeds + "
" + _ "Client's Comments: " + "
" + ContactUs_Comments + "

DO NOT REPLY TO THIS MESSAGE TO CONTACT THE CLIENT." 'strBody = strBody & "Contact Us Form submitted at " & Now() & vbCrLf & "

" 'strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") & vbCrLf & "
" 'strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "
" 'strBody = strBody & "Name" & " : " & " " & Replace(ContactUs_Name,vbCr,"
") & "
" 'strBody = strBody & "Email" & " : " & " " & Replace(ContactUs_Email,vbCr,"
") & "
" 'strBody = strBody & "Subject" & " : " & " " & Replace(ContactUs_Subject,vbCr,"
") & "
" 'strBody = strBody & "
" & Replace(ContactUs_Body,vbCr,"
") & "
" '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") = 465 ObjSendMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1 'Use SSL for the connection 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.To = "jeffcashman@ctinsurancegroup.com" ObjSendMail.Subject = ContactUs_Subject ObjSendMail.From = ContactUs_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 %> Your request for a quote has been sent. Thank You !!

<% Else %>

Request a Quote




* = Required Field
First Name(s): *
Last Name: *
Current Address: *
Current Town, City & ZipCode: *
Property Address: *
Property Town, City & ZipCode: *
Telephone: *
Fax:
E-Mail:
Best Time to Call:
Your Insurance Needs
Homeowners Life Long-Term Care
Automobile Health Valuable Articles
Umbrella/Excess Liability Flood Yacht
Condominium/Renters Disability  

Comments:
 


<% End If %>