<%@ include file="header.jsp" %> <%@ import = "javax.mail.*,javax.mail.internet.*,javax.activation.*,java.net.InetAddress" %> <% boolean shouldShowFirstForm = true; boolean shouldShowSecondForm = true; String param_info[][] = { {"companyName", "Company Name", "not required", ""}, {"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"}, {"numberEmployees", "Number Employees", "not required", ""}, {"typePolicy", "Type Policy", "required", "You must indicate what type of coverage you wish."}, {"renewalDateMonth", "Renewal Month", "not required", ""}, {"renewalDateDay", "Renewal Day", "not required", ""}, {"renewalDateYear", "Renewal Year", "not required", ""}, {"currentCarrier", "Current Carrier", "required", "You must list the name of your current carrier. If you don't currently have coverage, please enter 'None'."}, {"descriptionPlan", "Description of Plan", "not required", ""}, {"remarks", "Remarks", "not required", ""}, }; if (request.getParameter("op") == null) { shouldShowFirstForm = true; shouldShowSecondForm = 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 ((request.getParameter("companyName") != null) && (request.getParameter("companyName").length() != 0)) { if ((request.getParameter("numberEmployees") == null) || (request.getParameter("numberEmployees").length() == 0)) { errmsg = errmsg.concat("
  • If you are a company, you must enter the number of employees."); } } if (errmsg == "") { shouldShowFirstForm = false; shouldShowSecondForm = true; } else { shouldShowFirstForm = true; shouldShowSecondForm = 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("

    "); } } } %> <% if (shouldShowFirstForm == true) { %>

    Health 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 ">

    Policy Information
    Type of Policy
    Renewal Date (MM/DD/YY) ">">"> Current Carrier ">
    Number of Employees: Only required for Company requests ">
    Description of Plan

    Remarks:

    <% } if (shouldShowSecondForm == 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\n"); if (request.getParameter("typePolicy") != null) { msgBasetext.append("Type or Policy : " + request.getParameter("typePolicy") + "\n"); } if (request.getParameter("renewalDateMonth") != null) { msgBasetext.append("Renewal Date : " + request.getParameter("renewalDateMonth") + " " + request.getParameter("renewalDateDay") + " " + request.getParameter("renewalDateYear") + "\n"); } if (request.getParameter("currentCarrier") != null) { msgBasetext.append("Current Carrier : " + request.getParameter("currentCarrier") + "\n"); } if (request.getParameter("numberEmployees") != null) { msgBasetext.append("Number Employees : " + request.getParameter("numberEmployees") + "\n"); } if (request.getParameter("descriptionPlan") != null) { msgBasetext.append("\nPlan Description\n--------------------------------------------------------------------------------\n" + request.getParameter("descriptionPlan") + "\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 = "Health 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" %>