<% function sendmail(toemail, fromname, fromemail, msubject, mbody, ReplyTo) dim Mail Set Mail = Server.CreateObject("Persits.MailSender") Mail.IsHTML = True ' Mail.Host = "203.199.89.192" Mail.Host = "67.222.144.106" Mail.From = "info@gooddrivers.ca" Mail.AddBcc "info@gooddrivers.ca" Mail.FromName = fromname if trim(ReplyTo)<>"" then Mail.AddReplyTo ReplyTo toArr = split(toemail,",") for i=0 to ubound(toArr) Mail.AddAddress toArr(i) ' Name is optional next Mail.Subject = msubject Mail.Body = mbody On Error Resume Next Mail.Send If Err <> 0 Then emailstat= "Error encountered: " & Err.Description else emailstat= "" End If set Mail = nothing sendmail=emailstat end function '// get form data firstname = request.form("firstname") lastname = request.form("lastname") phone = request.form("phone") contemail = request.form("contemail") address = request.form("address") city = request.form("city") pin = request.form("pin") startdt = request.form("startdt") comment = request.form("comment") frnname = request.form("frnname") frnemail = request.form("frnemail") frmtype = request.form("frmtype") EMsg = "" strInsert = "" if trim(frmtype) = "" then frm_heading="Register Online" if trim(firstname) = "" then EMsg=EMsg & " - First Name
" if trim(lastname) = "" then EMsg = EMsg & " - Last Name
" if trim(phone) = "" then EMsg=EMsg & " - Contact Number
" 'if trim(contemail) = "" then EMsg=EMsg & " - Email
" if trim(address) = "" then EMsg=EMsg & " - Address
" if trim(city) = "" then EMsg=EMsg & " - City
" if trim(pin) = "" then EMsg=EMsg & " - Postal Code
" if trim(startdt) = "" then EMsg=EMsg & " - Course Start Date
" else frm_heading="Refer us to a Friend" if trim(frnname) = "" then EMsg=EMsg & " - Friend's Name
" if trim(frnemail) = "" then EMsg=EMsg & " - Friend's Email
" end if if trim(EMsg) = "" then fromname = "Art of Good Drivers" fromemail = "info@gooddrivers.ca" ReplyTo = "info@gooddrivers.ca" if trim(frmtype)="" then subject="Registration from website" body = "First Name: "& firstname &"
Last Name: "& lastname &"
Contact Number: "& phone &"
Contact Email: "& contemail & "
Address: "& address & "
City: "& city & "
Postal Code: "& pin & "
Course Start Date: " & startdt & "
Comment: " & comment & "
" toemail = "info@gooddrivers.ca" 'toemail = "write2sachin.kalra@gmail.com" strInsert = "insert into registration (firstname, lastname, phone, contemail, address, city, pin, startdt, comment, logdate, updated) values ('" & firstname &"', '"& lastname &"', '"& phone &"', '"& contemail & "', '"& address & "', '"& city & "', '"& pin & "', '" & startdt & "', '" & comment & "', #"& date() & " " & time() &"#, #"& date() & " " & time() & "#)" else subject="Check-out this website" body="Hey,

Check-out Good Drivers' Training Centre's website! It's approved by the government and offers the entire Defensive Drivers Training program for only $395. If we register together, we'll get a group discount." toemail = frnemail strInsert = "insert into refer_friend (frnname, frnemail, logdate, updated) values ('" & frnname &"', '" & frnemail &"', #"& date() & " " & time() &"#, #"& date() & " " & time() & "#)" end if EMsg=sendmail(toemail, fromname, fromemail, subject, body, ReplyTo) if Trim(EMsg) = "" Then emailsenton = date() & " " & time() ' response.write strInsert ' response.end con.Execute (strInsert) if Trim(EMsg) = "" Then response.redirect "thanks.htm" else EMsg=EMsg & "ERROR
Form not submitted" end if end if if Trim(EMsg) <> "" Then %> Untitled Document
 
 

<%= frm_heading%>
ERROR: Form not submitted

<%= EMsg%>
   
<% end if %>