Beispiel #1
0
 /**
  * @param localFlag
  * @return String
  */
 private String sendMail(HashMap<String, List<EmailPojo>> hashMapMail, boolean localFlag) {
   String failrueId = null;
   String accountName = null;
   String getfailrueId;
   try {
     for (String key : hashMapMail.keySet()) {
       List<EmailPojo> mailPojoList = hashMapMail.get(key);
       Account account = mailPojoList.get(0).getAccount();
       accountName = account.getName();
       Operator operator;
       if (localFlag) {
         operator = (Operator) beanFactory.getBean("localsmtp");
       } else {
         if (beanFactory.containsBean(account.getSendProtocolType())) {
           operator = (Operator) beanFactory.getBean(account.getSendProtocolType());
         } else {
           operator = (Operator) beanFactory.getBean("localsmtp");
         }
       }
       getfailrueId = operator.sendMail(mailPojoList);
       if (failrueId == null) {
         if (getfailrueId != null) {
           failrueId = getfailrueId;
         }
       } else {
         if (getfailrueId != null) {
           failrueId += "," + getfailrueId;
         }
       }
     }
   } catch (Exception e) {
     log.error("sendMail/SendMailListener/Exception: " + "[" + accountName + "]", e);
   }
   return failrueId;
 }
Beispiel #2
0
  /**
   * Returns the protocol that will be used to send the email.
   *
   * @param hashMapMail
   * @return
   */
  private String getSendProtocolType(HashMap<String, List<EmailPojo>> hashMapMail) {
    String sendProtocolType = null;

    for (String key : hashMapMail.keySet()) {
      List<EmailPojo> mailPojoList = hashMapMail.get(key);
      Account account = mailPojoList.get(0).getAccount();
      sendProtocolType = account.getSendProtocolType();

      break;
    }

    return sendProtocolType;
  }