Package cn.bran.play.exceptions

Examples of cn.bran.play.exceptions.MailException


            }
            // reset the infomap
            infos.remove();
            return Mail.send(email);
        } catch (EmailException ex) {
            throw new MailException("Cannot send email", ex);
        }
    }
View Full Code Here


        }

      email.setMailSession(getSession());
      return sendMessage(email);
    } catch (EmailException ex) {
      throw new MailException("Cannot send email", ex);
    }
  }
View Full Code Here

        .getString("mail.smtp.from");

    if (email.getFromAddress() == null && !StringUtils.isEmpty(from)) {
      email.setFrom(from);
    } else if (email.getFromAddress() == null) {
      throw new MailException("Please define a 'from' email address",
          new NullPointerException());
    }
    if ((email.getToAddresses() == null || email.getToAddresses().size() == 0)
        && (email.getCcAddresses() == null || email.getCcAddresses()
            .size() == 0)
        && (email.getBccAddresses() == null || email.getBccAddresses()
            .size() == 0)) {
      throw new MailException("Please define a recipient email address",
          new NullPointerException());
    }
    if (email.getSubject() == null) {
      throw new MailException("Please define a subject",
          new NullPointerException());
    }
    if (email.getReplyToAddresses() == null
        || email.getReplyToAddresses().size() == 0) {
      email.addReplyTo(email.getFromAddress().getAddress());
View Full Code Here

          try {
            msg.setSentDate(new Date());
            msg.send();
            return true;
          } catch (Throwable e) {
            MailException me = new MailException(
                "Error while sending email", e);
            Logger.error("The email has not been sent", me);
            return false;
          }
        }
      });
    } else {
      final StringBuffer result = new StringBuffer();
      try {
        msg.setSentDate(new Date());
        msg.send();
      } catch (Throwable e) {
        MailException me = new MailException(
            "Error while sending email", e);
        Logger.error("The email has not been sent", me);
        result.append("oops");
      }
      return new Future<Boolean>() {
View Full Code Here

TOP

Related Classes of cn.bran.play.exceptions.MailException

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.