<% 'Dim variables Dim vTry, bValidForm Dim vName, vEmail, vSubject, vMessage,vtelephone Dim bName, bEmail, bSubject, bMessage,btelephone vTry = Request.QueryString("Try") bValidForm = False vName = "" Email = "" vSubject = "" vMessage = "" vtelephone="" btelephone="" vName = Request.Form("txtName") vEmail = Request.Form("txtEmail") vSubject = Request.Form("txtSubject") vMessage = Request.Form("txtMessage") vtelephone=Request.Form("txtTelephone") 'Check if E-mail adrress is valid. function isValidEmail(byval vEmail) ' very simple email validation function. returnVal = false if not isEmpty(vEmail) then if instr(vEmail, "@") > 0 and instr(vEmail, ".") > 0 then returnVal = true end if end if isValidEmail = returnVal end function 'Check if field is filled with data and if e-mail is correct if vName = "" then bName = false else bName = true end if if isValidEmail(vEmail) then bEmail = true else bEmail = false end if If bName and bEmail = True and vTry = "Second" or vTry = "Third" Then bValidForm = True Name = Request.Form("txtName") Email = Request.Form("txtEmail") Subject = Request.Form("txtSubject") Message = Request.Form("txtMessage") Address = Request.Form("txtaddress") Telephone= Request.Form("txtTelephone") Company = Request.Form("txtCompany") newfriend1=Request.Form("txtfriend1") newfriend2=Request.Form("txtfriend2") newfriend3=Request.Form("txtfriend3") newfriend4=Request.Form("txtfriend4") newfemail1=Request.Form("txtfemail1") newfemail2=Request.Form("txtfemail2") newfemail3=Request.Form("txtfemail3") newfemail4=Request.Form("txtfemail4") Set Mail = Server.CreateObject("Persits.MailSender") Mail.Host = "mail.fmsb.com.my" ' Specify a valid SMTP server Mail.From = Email ' Specify sender's address Mail.FromName = Name ' Specify sender's name Mail.Username = "admin@fmsb.com.my" Mail.Password = "ums66fbu" Mail.AddAddress "ttsoon@fmsb.com.my" Mail.AddReplyTo Email Mail.Subject = "REFER A FRIEND" newname = "Name: " & Name & chr(10) newcontact = "Company: " & Company & chr(10) newemail = "Email Address: " & Email & chr(10)& chr(10) newaddress = "Address : " & address & chr (10) & chr(10) newheading = "REFER A FRIEND" & chr(10) & chr(10) newmessage = "I/We would like to refer our friends for your company's services." & chr(10) & chr(10) newmessage2 = "" newtelephone = "My telephone number is " & Telephone & chr(10) & chr(10) newemailfriend1 = newfriend1 & " - " & newfemail1 & chr(10) & chr(10) newemailfriend2 = newfriend2 & " - " & newfemail2 & chr(10) & chr(10) newemailfriend3 = newfriend3 & " - " & newfemail3 & chr(10) & chr(10) newemailfriend4 = newfriend4 & " - " & newfemail4 & chr(10) & chr(10) Mail.Body = newname & newcontact & newemail & newaddress & newtelephone & newheading & newmessage & newmessage2 & newemailfriend1 & newemailfriend2 & newemailfriend3 & newemailfriend4 On Error Resume Next Mail.Send If Err <> 0 Then Response.Write "Error encountered: " & Err.Description End If Response.Redirect "SendSucces.asp" Else bValidForm = False End If If vTry = "" Then vTry = "Second" Else vTry = "Third" End If If Request.QueryString("Try") = "Second" or Request.QueryString("Try") = "" Then %> newreferfriend.asp

REFER YOUR FRIEND(S)

Please provide us with your contact telephone number for immediate response      on your enquiries/feedback.

<% if vTry = "Third" Then %> <% End If %>
Please fill in the red marked fields. Thank you!
<% if bName = False and vTry = "Third" Then response.write "" end if %> Your Name <% if bName = False and vTry = "Third" Then response.write "" end if %>
Your Company
<% if bEmail = False and vTry = "Third" Then response.write "" end if %> Your E-mail <% if bEmail = False and vTry = "Third" Then response.write "" end if %>
Telephone/
Mobile
Your address
Please enter the names and email address of your friends here Name Email Address
 



 

<% Else If Request.QueryString ("Try") = "Third" Then response.redirect "WrongData.asp" End If End If %>