org.apache.commons.mail.Email.getToAddresses()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.apache.commons.mail.Email.getToAddresses()方法的一些代码示例,展示了Email.getToAddresses()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Email.getToAddresses()方法的具体详情如下:
包路径:org.apache.commons.mail.Email
类名称:Email
方法名:getToAddresses

Email.getToAddresses介绍

[英]Get the list of "To" addresses.
[中]获取“收件人”地址列表。

代码示例

代码示例来源:origin: aintshy/hub

@Override
  public void deliver(final Email email) {
    Logger.info(this, "email to %s", email.getToAddresses());
  }
};

代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail

@Override
public Future<Void> asyncSend(final Email email) {
  LOGGER.debug("New email to be sent asynchronously: {} to {}", email.getSubject(), email.getToAddresses());
  Callable<Void> task = new Callable<Void>() {
    @Override
    public Void call() throws EmailException {
      LOGGER.debug("Asynchronously sending email {} to {}", email.getSubject(), email.getToAddresses());
      DefaultAsyncMailer.this.mailer.send(email);
      return null;
    }
  };
  return this.executor.submit(task);
}

代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail

@Override
  public Void call() throws EmailException {
    LOGGER.debug("Asynchronously sending email {} to {}", email.getSubject(), email.getToAddresses());
    DefaultAsyncMailer.this.mailer.send(email);
    return null;
  }
};

代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail

@Override
  public void send(Email email) throws EmailException {
    logger.info("subject => {}",email.getSubject());
    logger.info("from => {}",email.getFromAddress());
    logger.info("toAddresses => {}",email.getToAddresses());
    if(email instanceof SimpleEmail)
      send((SimpleEmail) email);
    else if(email instanceof HtmlEmail)
      send((HtmlEmail) email);
    else
      logger.info("body => unknown");
  }
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play

public static Email buildMessage(Email email) throws EmailException {
  String from = Play.configuration.getProperty("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().isEmpty())
      && (email.getCcAddresses() == null || email.getCcAddresses().isEmpty())
      && (email.getBccAddresses() == null || email.getBccAddresses().isEmpty())) {
    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().isEmpty()) {
    email.addReplyTo(email.getFromAddress().getAddress());
  }
  return email;
}

代码示例来源:origin: com.google.code.maven-play-plugin.org.playframework/play

content.append("\n\tReplyTo: ").append(email.getReplyToAddresses().get(0).getAddress());
addAddresses(content, "To",  email.getToAddresses());
addAddresses(content, "Cc",  email.getCcAddresses());
addAddresses(content, "Bcc", email.getBccAddresses());
Logger.info(content.toString());
for (Object add : email.getToAddresses()) {
  content.append(", ").append(add);
  emails.put(((InternetAddress) add).getAddress(), content.toString());

代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail

protected void wrapUpAndSend(Email email) throws EmailException {
  LOGGER.debug(String.format(emailLogTemplate(),
      email.getSubject(),
      email.getFromAddress(),
      email.getToAddresses(),
      email.getHostName(),
      email.getSmtpPort(),
      email.isTLS()));
  email.send();
}

代码示例来源:origin: br.com.caelum.vraptor/vraptor-simplemail

public void send(Email email) throws EmailException{
    boolean sendForReal = env.has(SEND_REAL_EMAIL) || env.getName().equals("production");
    if (sendForReal) {
      logger.info("REAL MAIL ::: {} ::: {}", email.getSubject(),
          email.getToAddresses());

      if (email.getFromAddress() == null) {
        email.setFrom(env.get(FROM));
      }
      if (env.has(REPLY_TO)) {
        email.addReplyTo(env.get(REPLY_TO));
      }

      email.setMailSession(session);

      try {
        client.sendRawEmail(new SendRawEmailRequest()
            .withRawMessage(mail2Content(email)));
      } catch (Exception e) {
        throw new EmailException(e);
      }
    } else {
      new MockMailer().send(email);
    }
  }
}

相关文章

微信公众号

最新文章

更多