<%@ 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[][] = { {"firstName", "First Name", "required", "You must enter your First Name"}, {"companyName", "Company Name", "not required", ""}, {"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 Address"}, {"remarks", "Remarks", "not required", ""}, {"numPersons", "Number of Persons to Cover", "required", "You must enter the number of persons to cover"}, }; 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) { %>

    Life Insurance Quote Request:
    General Information
    Name (First, Last): ">">
    If this is a corporate or company request, please enter your company name
    Company Name: ">
    Address ">
      ">
    City/State/Zip ">">">
    Phone "> Fax ">
    E-Mail Address ">

    Coverage
    Number of Persons to Cover: ">

    Remarks:

    <% } if (shouldShowSecondForm == true) { int numPersons = Integer.parseInt(request.getParameter("numPersons"), 10); %>
    You have indicated that you are seeking insurance for <% out.print(numPersons) %> people. In order to expedite the quotation process, we ask that you fill in the following information for each person. However, if you wish to send us information for each persons in another manner, simply leave these fields blank and continue to the next section.
    <% for(int i = 0; i < numPersons; 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(" Client Information - " + numPersons ); out.println("
    Name (First, Last):
    Address
     
    City/State/Zip
    Birthday (MM/DD/YY)Male/FemaleMale/Female
    Any Tobacco Use Within (12 Months)Yes/No
    Amount of CoveragePlan of Insurance"); out.println(" "); out.println("
    "); 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 to Cover : " + request.getParameter("numPersons") + "\n\n"); int numPersons = Integer.parseInt(request.getParameter("numPersons"), 10); for(int i = 0; i < numPersons; i++) { msgBasetext.append("\n\n"); msgBasetext.append("Information for Person " + (i + 1)); msgBasetext.append("\n--------------------------------------------------------------------------------\n"); msgBasetext.append("Name : " + request.getParameter("clientFirstName" + i) + " " + request.getParameter("clientLastName" + i) + "\n"); msgBasetext.append("Address : " + request.getParameter("clientAddress1" + i) + "\n"); msgBasetext.append(" " + request.getParameter("clientAddress2" + i) + "\n"); msgBasetext.append("City/State/Zip : " + request.getParameter("clientCity" + i) + " " + request.getParameter("clientState" + i) + " " + request.getParameter("clientZip" + i) + "\n\n"); msgBasetext.append("Birthday : " + request.getParameter("birthdayMonth" + i) + "/" + request.getParameter("birthdayDay" + i) + "/" + request.getParameter("birthdayYear" + i) + "\n"); msgBasetext.append("Sex : " + request.getParameter("maleFemale" + i) + "\n"); msgBasetext.append("Tobacco Use : " + request.getParameter("tobaccoUse" + i) + "\n"); msgBasetext.append("Amount of Coverage : " + request.getParameter("amountCoverage" + i) + "\n"); msgBasetext.append("Plan of Insurance : " + request.getParameter("planInsurance" + i) + "\n"); } String mailhost = "couchnt03.couchbraunsdorf.com"; String msgfrom = request.getParameter("firstName") + " " + request.getParameter("lastName") + " <" + request.getParameter("email") + ">"; String msgto = "life-health@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 = "life-health@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" %>