Package com.founder.fix.fixflow.core.impl.util

Examples of com.founder.fix.fixflow.core.impl.util.MailUtil


      try {
        FixMailTo fixMailTo = new FixMailTo();
        fixMailTo.persistentInit(mapData);

        MailUtil mailUtil = new MailUtil();
        mailUtil.setSmtpHost(mailInfoObj.getSmtpHost(), StringUtil.getInt(mailInfoObj.getSmtpPort()));
        mailUtil.setSmtpAuthentication(mailInfoObj.getUserName(), mailInfoObj.getPassWord());
        // 支持发送多人邮件 #4185
        String to = fixMailTo.getMailTo();
        if (to == null || to.equals("")) {
          throw new FixFlowBizException("mailTo is null");
        }
        String[] str = to.split(",");
        List<String> userMailToList=new ArrayList<String>();
        for (String userMail : str) {
         
          if(userMail==null||userMail.equals("")||userMail.trim().equals("")){
           
          }
          else{
            userMailToList.add(userMail);
          }
         
         
         
         
        }
       
        if(userMailToList.size()==0){
          throw new FixFlowBizException("Mail toaddress is null");
        }
        String[] userMailToFinStrings=(String[])userMailToList.toArray(new String[userMailToList.size()]);
       
       
        mailUtil.setTo(userMailToFinStrings);
       
       
       
       
       
        String cc = fixMailTo.getMailCc();
        if (cc != null && !cc.equals("")) {
          String[] strCC = cc.split(",");
         
          List<String> userMailCCList=new ArrayList<String>();
          for (String userMail : strCC) {
           
            if(userMail==null||userMail.equals("")||userMail.trim().equals("")){
             
            }
            else{
              userMailCCList.add(userMail);
            }
           
          }
         
          if(userMailCCList.size()==0){
            throw new FixFlowBizException("Mail ccaddress is null");
          }
         
          String[] userMailCCFinStrings=(String[])userMailCCList.toArray(new String[userMailCCList.size()]);
     
         
         
         
          mailUtil.setCC(userMailCCFinStrings);
        }
        String title = fixMailTo.getMailSubject();
        String mailContent = fixMailTo.getMailBody();

        mailUtil.setFrom(mailInfoObj.getMailAddress());
        mailUtil.setSubject(title);
        mailUtil.setBody(mailContent);
        mailUtil.setContentType(mailUtil.MODE_HTML);
       

        Map<String, Object> objectParam = new HashMap<String, Object>();
        objectParam.put("MAIL_STATUS", MailStatus.COMPLETE.toString());

        // 构建Where查询参数
        Object[] objectParamWhere = { StringUtil.getString(mapData.get("MAIL_ID")) };

        sqlCommand.update("FIXFLOW_MAIL", objectParam, " MAIL_ID=?", objectParamWhere);
       
   
        // 异步发送
        mailUtil.send();

      } catch (Exception e) {

        try {
          Map<String, Object> objectParam = new HashMap<String, Object>();
View Full Code Here

TOP

Related Classes of com.founder.fix.fixflow.core.impl.util.MailUtil

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.