Package org.opentides.bean

Examples of org.opentides.bean.MailMessage


    //creates the mail message preparator from JobDataMap set in MailingServiceImpl
    MimeMessagePreparator preparator = new MimeMessagePreparator() {
          public void prepare(MimeMessage mimeMessage) throws Exception {
           VelocityEngine velocityEngine = MailingContext.getVelocityEngine();
             MimeMessageHelper message = new MimeMessageHelper(mimeMessage);
             MailMessage mailMessage = (MailMessage) dataMap.get("message");
             message.setFrom(mailMessage.getMsgFrom());
             message.setTo(mailMessage.getMsgTo());
             if (!StringUtil.isEmpty(mailMessage.getMsgBcc()))
               message.setBcc(mailMessage.getMsgBcc());
             if (!StringUtil.isEmpty(mailMessage.getMsgCc()))
             message.setCc(mailMessage.getMsgCc());
             message.setSubject(mailMessage.getSubject());
             String text = VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, mailMessage.getTemplate(), mailMessage.getDataMap());
             message.setText(text, true);
             _log.info("Sending email to ["+mailMessage.getMsgTo()+"] with subject ["+mailMessage.getSubject()+"].");
          }
       };
       //send the mail message...
       mailSender.send(preparator);
  }
View Full Code Here

TOP

Related Classes of org.opentides.bean.MailMessage

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.