<%@ LANGUAGE="VBSCRIPT" %> <% option explicit %> <% Response.Buffer = True %> <% '*********************************************************************** ' COPYRIGHT NOTICE ' Code Example : Self Submitting "Contact Us" Form Using CDOSYS ' Author : Christopher Williams of ' www.CJWSoft.com and www.PowerASP.com ' You can use this code anywhere as long as this copyright notice ' remains with the code and the link to www.PowerASP.com remains on the ' form page this code is used on ' ' (c) Copyright 2000 - 2005 by CJWSoft / PowerASP All rights reserved '*********************************************************************** %> <% 'Declaring Variables Dim smtpserver,youremail,yourpassword,Name,Job_Title,Company,Address,City,State_Prov,Country,Phone,Fax,Email,How_Hear,Event_Date,Event_Time,Event_Location 'Don't change this line Dim ContactUs_Subject,ContactUs_Body,Action,IsError ' Edit these 3 values accordingly smtpserver = "mx1.wc1.sat1.stabletransit.com" youremail = "info@alvinlaw.com" yourpassword = "darlene09" ' Grabbing variables from the form post Name = Request("Name") Job_Title = Request("Job_Title") Company = Request("Company") Address = Request("Address") City = Request("City") State_Prov = Request("State_Prov") Country = Request("Country") Phone = Request("Phone") Fax = Request("Fax") Email = Request("Email") How_Hear = Request("How_Hear") Event_Date = Request("Event_Date") Event_Time = Request("Event_Time") Event_Location = Request("Event_Location") Action = Request("Action") ' 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 %> Alvin Law - Motivational Speaker - AJL Communications Ltd
AJL Communications Ltd
Home About Promo Bookings FAQ Gallery Videos  Passages DVD Radio Buy Book Contact


AJL Communications Ltd
Alvin's Laws
Alvin's Laws of Life
Programs
Available Programs
Equipment List
Audio/Visual Requirements
Clients
Client List
Testimonials
Client Testimonials



 


Booking Inquiry - Fields marked (*) are required
[ School Bookings Click Here ]
 
<% If Action = "SendEmail" Then ' Here we quickly check/validate the information entered ' These checks could easily be improved to look for more things If Name = "" Then IsError = "Yes" Response.Write("Please Enter a Name
") End If If IsValidEmail(Email) = "False" Then IsError = "Yes" Response.Write("Please 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 = strBody & "Submission Entered At " & Now() & vbCrLf & "

" strBody = strBody & "From http://" & Request.ServerVariables("HTTP_HOST") & vbCrLf & "
" strBody = strBody & "IP " & Request.ServerVariables("REMOTE_ADDR") & vbCrLf & "

" strBody = strBody & "Name" & " : " & " " & Replace(Name,vbCr,"
") & "
" strBody = strBody & "Job Title" & " : " & " " & Replace(Job_Title,vbCr,"
") & "
" strBody = strBody & "Company" & " : " & " " & Replace(Company,vbCr,"
") & "
" strBody = strBody & "Address" & " : " & " " & Replace(Address,vbCr,"
") & "
" strBody = strBody & "City" & " : " & " " & Replace(City,vbCr,"
") & "
" strBody = strBody & "State-Province" & " : " & " " & Replace(State_Prov,vbCr,"
") & "
" strBody = strBody & "Country" & " : " & " " & Replace(Country,vbCr,"
") & "
" strBody = strBody & "Phone" & " : " & " " & Replace(Phone,vbCr,"
") & "
" strBody = strBody & "Fax" & " : " & " " & Replace(Fax,vbCr,"
") & "
" strBody = strBody & "Email" & " : " & " " & Replace(Email,vbCr,"
") & "
" strBody = strBody & "How Did You Hear About Alvin" & " : " & " " & Replace(How_Hear,vbCr,"
") & "
" strBody = strBody & "Event Date" & " : " & " " & Replace(Event_Date,vbCr,"
") & "
" strBody = strBody & "Event Time" & " : " & " " & Replace(Event_Time,vbCr,"
") & "
" strBody = strBody & "Event Location" & " : " & " " & Replace(Event_Location,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") = 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 ' If your server requires outgoing authentication uncomment the lines bleow and use a valid email address and password. '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 = "Booking Submission" 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 %> Submission Successful...
Thank You !!
<% =Replace(ContactUs_Body,vbCr,"
") %>
<% Else %>
Name *
Job Title
Company
Address
City
State/Province
Country
Phone
Fax
Email *
How did you learn about Alvin?
Date of your event
Time of your event
Location of your event
(City, Province/State)

<% End If %>
top
Copyright © - AJL Communications Ltd - All Rights Reserved Privacy Policy  |  Terms Of Use