示例#1
0
 public static ActionForward sendEmail(
     HttpServletRequest request, Sender sender, Recipient... recipient) {
   EmailBean emailBean = new EmailBean();
   if (recipient != null) {
     emailBean.setRecipients(Arrays.asList(recipient));
   }
   if (sender != null) {
     emailBean.setSender(sender);
   }
   request.setAttribute("emailBean", emailBean);
   return FORWARD_TO_NEW_EMAIL;
 }
示例#2
0
 public ActionForward sendEmail(
     ActionMapping mapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response) {
   EmailBean emailBean = getRenderedObject("emailBean");
   RenderUtils.invalidateViewState();
   String validate = emailBean.validate();
   if (validate != null) {
     final String noneSentString =
         BundleUtil.getString(Bundle.APPLICATION, "error.email.none.sent");
     request.setAttribute("errorMessage", noneSentString + " " + validate);
     request.setAttribute("emailBean", emailBean);
     return mapping.findForward("new.email");
   }
   final Message message = emailBean.send();
   request.setAttribute("created", Boolean.TRUE);
   return new FenixActionForward(
       request,
       new ActionForward(
           "/viewSentEmails.do?method=viewEmail&messagesId=" + message.getExternalId(), true));
 }
示例#3
0
  @EntryPoint
  public ActionForward newEmail(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    EmailBean emailBean = getRenderedObject("emailBean");

    if (emailBean == null) {
      emailBean = (EmailBean) request.getAttribute("emailBean");
    }

    if (emailBean == null) {
      emailBean = new EmailBean();
      final Set<Sender> availableSenders = Sender.getAvailableSenders();
      if (availableSenders.size() == 1) {
        emailBean.setSender(availableSenders.iterator().next());
      }
    }
    RenderUtils.invalidateViewState();
    request.setAttribute("emailBean", emailBean);
    return mapping.findForward("new.email");
  }