Package com.centraview.mail

Examples of com.centraview.mail.MailLocal


   */
  public boolean simpleMessage(int individualID, MailMessageVO mailMessageVO) throws NamingException,CreateException, SendFailedException, MessagingException
  {
      InitialContext ic = CVUtility.getInitialContext();
      MailLocalHome home = (MailLocalHome)ic.lookup("local/Mail");
      MailLocal remote = (MailLocal)home.create();
      remote.setDataSource(dataSource);
      boolean sendFlag = remote.simpleMessage(individualID,mailMessageVO);
      return sendFlag;
  } // end public
View Full Code Here


  {
    String errorMessage = "";
    try {
      InitialContext ic = CVUtility.getInitialContext();
      MailLocalHome home = (MailLocalHome)ic.lookup("local/Mail");
      MailLocal remote = home.create();
      remote.setDataSource(dataSource);

      messageVO.setEmailAccountID(accountID);

      MailAccountVO accountVO = remote.getMailAccountVO(accountID);
      if (accountVO == null) {
        accountVO = new MailAccountVO();
      }
      if (accountVO.getAccountID() != -1) {
        InternetAddress fromAddress = new InternetAddress(accountVO.getEmailAddress(), accountVO.getAccountName());
        messageVO.setFromAddress(fromAddress.toString());
        messageVO.setReplyTo(fromAddress.toString());
        messageVO.setSubject(subject);
        messageVO.setHeaders("");
        messageVO.setContentType(MailMessageVO.HTML_TEXT_TYPE);
        messageVO.setReceivedDate(new java.util.Date());
        if (content != null && content.size() != 0) {
          // content is an arrayList of strings which are the customized messages
          for (int i = 0; i < content.size(); i++) {
            String bodyContent = (String)content.get(i);
            messageVO.setBody(bodyContent);
            // to is an arraylist of corresponding addresses
            String toAddress = (String)to.get(i);
            if (CVUtility.isEmailAddressValid(toAddress)) {
              ArrayList toList = new ArrayList();
              toList.add(toAddress);
              messageVO.setToList(toList);
              try {
                boolean messageSent = remote.sendMessage(accountVO, messageVO);
                if (messageSent) {
                  logger.debug("["+dataSource+"]Successfully Sent Mail Merge to: "+toAddress);
                } else {
                  logger.error("["+dataSource+"]Mail Merge Failed sending message to: "+messageVO.getToList()+", from account: "+accountVO.getAccountID());
                }
View Full Code Here

TOP

Related Classes of com.centraview.mail.MailLocal

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.