@RequestMapping(value = "/contactus/success", method = RequestMethod.POST)
  public String sendConfirmationEmail(
      @RequestParam("name") String name,
      @RequestParam("emailAddress") String emailAddress,
      @RequestParam("comments") String comments) {
    HashMap<String, Object> vars = new HashMap<String, Object>();
    vars.put("name", name);
    vars.put("comments", comments);
    vars.put("emailAddress", emailAddress);

    EmailInfo emailInfo = new EmailInfo();

    emailInfo.setFromAddress(emailAddress);
    emailInfo.setSubject("Message from " + name);
    emailInfo.setMessageBody(
        "Name: " + name + "<br />Email: " + emailAddress + "<br />Comments: " + comments);
    EmailTargetImpl emailTarget = new EmailTargetImpl();

    emailTarget.setEmailAddress(targetEmailAddress);
    try {
      emailService.sendBasicEmail(emailInfo, emailTarget, vars);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return "redirect:/contactus";
    }

    return "contactus/success";
  }
Пример #2
0
  private void sendConfirmationEmail(TCAProfileVO tcaProfile) {

    ETSAdminUser adminUser = tcaProfile.getAdminUser();
    HashMap<String, Object> vars = new HashMap<String, Object>();
    vars.put("admin", adminUser);
    emailService.sendTemplateEmail(adminUser.getEmail(), getSendAdminUserRegistrationMail(), vars);
  }
 public void sendConfirmationEmail(String orderNumber) {
   Order order = orderService.findOrderByOrderNumber(orderNumber);
   Customer customer = customerDao.readCustomerByEmail(order.getEmailAddress());
   if (customer != null) {
     HashMap<String, Object> vars = new HashMap<String, Object>();
     vars.put("customer", customer);
     vars.put("orderNumber", orderNumber);
     vars.put("order", order);
     emailService.sendTemplateEmail(
         customer.getEmailAddress(), getOrderConfirmationEmailInfo(), vars);
   }
 }