<%@ include file="header.jsp" %> <%@ import = "javax.mail.*,javax.mail.internet.*,javax.activation.*,java.net.InetAddress" %> <% boolean shouldShowFirstForm = true; boolean shouldShowSecondForm = true; boolean shouldShowThirdForm = true; String param_info[][] = { {"companyName", "Company Name", "required", "You must enter your Company Name"}, {"firstName", "First Name", "required", "You must enter your First Name"}, {"lastName", "Last Name", "required", "You must enter your Last Name"}, {"address1", "Address 1", "required", "You must enter your Address"}, {"address2", "Address 2", "not required", ""}, {"city", "City", "required", "You must enter your City"}, {"state", "State", "required", "You must enter your State"}, {"zip", "Zip Code", "required", "You must enter your Zip"}, {"phone", "Phone", "required", "You must enter your Phone Number"}, {"fax", "Fax", "not required", ""}, {"email", "E-Mail", "required", "You must enter your E-Mail"}, {"remarks", "Remarks", "not required", ""}, {"employeesUseOwnAutoForBusiness", "", "not required", ""}, {"employeesUseOwnAutoForBusinessExplained", "", "not required", ""}, {"reasonToRentLeaseBorrow", "", "not required", ""}, {"reasonToRentLeaseBorrowExplained", "", "not required", ""}, {"numberAutos", "Number Of Autos", "required", "You must enter the number of automobiles you company has"}, }; if (request.getParameter("op") == null) { shouldShowFirstForm = true; shouldShowSecondForm = false; shouldShowThirdForm = false; } else { if (request.getParameter("op").equals("Initial")) { String errmsg = ""; for (int i = 0; i < param_info.length; i++) { // Test if (param_info[i][2] == "required") { if ((request.getParameter(param_info[i][0]) == null) || (request.getParameter(param_info[i][0]).length() == 0)) { errmsg = errmsg.concat("
  • " + param_info[i][3]); } } } if (errmsg == "") { shouldShowFirstForm = false; shouldShowSecondForm = true; shouldShowThirdForm = false; } else { shouldShowFirstForm = true; shouldShowSecondForm = false; shouldShowThirdForm = false; out.println(""); out.println(" "); out.println(" "); out.println(" "); out.println("
    Sorry Your Application Is Incomplete
    We are missing some required information from the form you submitted. The following is a list of corrections you must make before we can process your application. Please make the corrections to the form below and resend it.
    "); out.println("
      "); out.println(errmsg); out.println("
    "); out.println("
    "); out.println("

    "); } } else { if (request.getParameter("op").equals("TypeOfCars")) { shouldShowFirstForm = false; shouldShowSecondForm = false; shouldShowThirdForm = true; } } } %> <% if (shouldShowFirstForm == true) { %>

    Commercial Auto Quote Request:
    General Information
    Company Name: ">
    Name (First, Last): ">">
    Address ">
      ">
    City/State/Zip ">">">
    Phone "> Fax ">
    E-Mail Address ">

    Auto Usage
    Number of Autos: ">
    Do your Employees use their own auto for your business operations? Yes/No
    If yes, please explain.
    Do you have reason to rent, lease or borrow autos for your business operations? Yes/No
    If yes, please explain.

    Remarks:

    <% } if (shouldShowSecondForm == true) { int numAutos = Integer.parseInt(request.getParameter("numberAutos"), 10); %>
    You have indicated that you are seeking insurance for <% out.print(numAutos) %> vehicles. In order to expedite the quotation process, we ask that you fill in the following information for each vehicle. However, if you wish to send us information for each vehicle in another manner, simply leave these fields blank and continue to the next section.
    <% for(int i = 0; i < numAutos; i++) { out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println(" "); out.println("
    "); out.println(" Information for Vehicle " + (i + 1) + ""); out.println("
    Make Of Car:
    Model Of Car:
    Year Of Car:
    VIN:
    Ownership:
    If Leased:
     Name Of Leasing Company:
     Lease Expires:
    Please Provide All Relevant Information About Any Accidents This Vehicle Has Been Involved In:
    "); out.println("

    "); } %>
    <% for (int i = 0; i < param_info.length; i++) { out.println(""); } %> <% } if (shouldShowThirdForm == true) { StringBuffer msgBasetext = new StringBuffer(); msgBasetext.append("From\n--------------------------------------------------------------------------------\nCompany Name : " + request.getParameter("companyName") + "\nName : " + request.getParameter("firstName") + " " + request.getParameter("lastName") + "\nAddress : " + request.getParameter("address1") + "\n " + request.getParameter("address2") + "\n " + request.getParameter("city") + ", " + request.getParameter("state") + " " + request.getParameter("zip") + "\nPhone : " + request.getParameter("phone") + "\nFax : " + request.getParameter("fax") + "\nE-mail : " + request.getParameter("email") + "\n\nNumber of Autos : " + request.getParameter("numberAutos") + "\n\n"); if (request.getParameter("employeesUseOwnAutoForBusiness").equals("yes")) { msgBasetext.append("Employees Use Own Auto For Business : \n" + request.getParameter("employeesUseOwnAutoForBusinessExplained") + "\n"); } if (request.getParameter("reasonToRentLeaseBorrow").equals("yes")) { msgBasetext.append("Reason To Rent Lease or Borrow : \n" + request.getParameter("reasonToRentLeaseBorrowExplained") + "\n"); } int numAutos = Integer.parseInt(request.getParameter("numberAutos"), 10); for(int i = 0; i < numAutos; i++) { msgBasetext.append("\n\n"); msgBasetext.append("Information for Vehicle " + (i + 1)); msgBasetext.append("\n--------------------------------------------------------------------------------\n"); msgBasetext.append("Make Of Car : " + request.getParameter("MakeOfCar" + i) + "\n"); msgBasetext.append("Model Of Car : " + request.getParameter("ModelOfCar" + i) + "\n"); msgBasetext.append("Year Of Car : " + request.getParameter("YearOfCar" + i) + "\n\n"); msgBasetext.append("VIN : " + request.getParameter("VIN" + i) + "\n\n"); msgBasetext.append("Ownership : " + request.getParameter("Ownership" + i) + "\n"); if (request.getParameter("Ownership" + i).equals("Leased")) { msgBasetext.append("Leasing Company : " + request.getParameter("LeasingCompany" + i) + "\n"); msgBasetext.append("Lease Expires : " + request.getParameter("LeaseExpires" + i) + "\n"); } if (request.getParameter("Accidents" + i) != null) { msgBasetext.append("Accidents : " + request.getParameter("Accidents" + i) + "\n"); } } String mailhost = "couchnt03.couchbraunsdorf.com"; String msgfrom = request.getParameter("firstName") + " " + request.getParameter("lastName") + " <" + request.getParameter("email") + ">"; String msgto = "commercial@couchbraunsdorf.com"; String msgcc = null; String msgbcc = "info@couchbraunsdorf.com"; String msgsubject = "Commercial Automobile Insurance Inquiry"; StringBuffer msgtext = new StringBuffer(); msgtext.append(msgBasetext); try { Properties props = System.getProperties(); if (mailhost != null) { props.put("mail.smtp.host", mailhost); } Session session = javax.mail.Session.getDefaultInstance(props, null); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(msgfrom)); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(msgto, false)); if (msgcc != null) { msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(msgcc, false)); } if (msgbcc != null) { msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(msgbcc, false)); } msg.setSubject(msgsubject); msg.setText("A " + msgsubject + " was recieved on the Couch Braunsdorf Insurance Web site:\n\n" + msgtext.toString()); msg.setHeader("X-Mailer", "Revolutionary Systems"); msg.setSentDate(new Date()); Transport.send(msg); } catch (Exception e) { out.print(""); } msgfrom = "commercial@couchbraunsdorf.com"; msgto = request.getParameter("email"); msgcc = null; msgbcc = null; msgtext = new StringBuffer(); msgtext.append(msgBasetext); try { Properties props = System.getProperties(); if (mailhost != null) { props.put("mail.smtp.host", mailhost); } Session session = javax.mail.Session.getDefaultInstance(props, null); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(msgfrom)); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(msgto, false)); if (msgcc != null) { msg.setRecipients(Message.RecipientType.CC, InternetAddress.parse(msgcc, false)); } if (msgbcc != null) { msg.setRecipients(Message.RecipientType.BCC, InternetAddress.parse(msgbcc, false)); } msg.setSubject(msgsubject); msg.setText("Thank You!\nYour " + msgsubject + " was recieved by Couch Braunsdorf Insurance.\n\nFor your records, below is the information you submitted to us.\n\n" + msgtext.toString() + "\n\nA memeber of the Couch Braunsdorf Insurance Commerical Insurance Team will contact you shortly about your inquiry.\n\nAgain, thank you for your interest in Couch Braunsdorf Insurance"); msg.setHeader("X-Mailer", "Revolutionary Systems"); msg.setSentDate(new Date()); Transport.send(msg); } catch (Exception e) { out.print(""); } %>
    Thank You
    You will be contacted shortly regarding your application by a representative within one business day. You will also shortly receive a message by e-mail confirm the contents of your application.
    <% } %> <%@ include file="footer.jsp" %>