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

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

本文整理了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

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

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

  1. @Override
  2. public Future<Void> asyncSend(final Email email) {
  3. LOGGER.debug("New email to be sent asynchronously: {} to {}", email.getSubject(), email.getToAddresses());
  4. Callable<Void> task = new Callable<Void>() {
  5. @Override
  6. public Void call() throws EmailException {
  7. LOGGER.debug("Asynchronously sending email {} to {}", email.getSubject(), email.getToAddresses());
  8. DefaultAsyncMailer.this.mailer.send(email);
  9. return null;
  10. }
  11. };
  12. return this.executor.submit(task);
  13. }

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

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

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

  1. @Override
  2. public void send(Email email) throws EmailException {
  3. logger.info("subject => {}",email.getSubject());
  4. logger.info("from => {}",email.getFromAddress());
  5. logger.info("toAddresses => {}",email.getToAddresses());
  6. if(email instanceof SimpleEmail)
  7. send((SimpleEmail) email);
  8. else if(email instanceof HtmlEmail)
  9. send((HtmlEmail) email);
  10. else
  11. logger.info("body => unknown");
  12. }
  13. }

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

  1. public static Email buildMessage(Email email) throws EmailException {
  2. String from = Play.configuration.getProperty("mail.smtp.from");
  3. if (email.getFromAddress() == null && !StringUtils.isEmpty(from)) {
  4. email.setFrom(from);
  5. } else if (email.getFromAddress() == null) {
  6. throw new MailException("Please define a 'from' email address", new NullPointerException());
  7. }
  8. if ((email.getToAddresses() == null || email.getToAddresses().isEmpty())
  9. && (email.getCcAddresses() == null || email.getCcAddresses().isEmpty())
  10. && (email.getBccAddresses() == null || email.getBccAddresses().isEmpty())) {
  11. throw new MailException("Please define a recipient email address", new NullPointerException());
  12. }
  13. if (email.getSubject() == null) {
  14. throw new MailException("Please define a subject", new NullPointerException());
  15. }
  16. if (email.getReplyToAddresses() == null || email.getReplyToAddresses().isEmpty()) {
  17. email.addReplyTo(email.getFromAddress().getAddress());
  18. }
  19. return email;
  20. }

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

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

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

  1. protected void wrapUpAndSend(Email email) throws EmailException {
  2. LOGGER.debug(String.format(emailLogTemplate(),
  3. email.getSubject(),
  4. email.getFromAddress(),
  5. email.getToAddresses(),
  6. email.getHostName(),
  7. email.getSmtpPort(),
  8. email.isTLS()));
  9. email.send();
  10. }

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

  1. public void send(Email email) throws EmailException{
  2. boolean sendForReal = env.has(SEND_REAL_EMAIL) || env.getName().equals("production");
  3. if (sendForReal) {
  4. logger.info("REAL MAIL ::: {} ::: {}", email.getSubject(),
  5. email.getToAddresses());
  6. if (email.getFromAddress() == null) {
  7. email.setFrom(env.get(FROM));
  8. }
  9. if (env.has(REPLY_TO)) {
  10. email.addReplyTo(env.get(REPLY_TO));
  11. }
  12. email.setMailSession(session);
  13. try {
  14. client.sendRawEmail(new SendRawEmailRequest()
  15. .withRawMessage(mail2Content(email)));
  16. } catch (Exception e) {
  17. throw new EmailException(e);
  18. }
  19. } else {
  20. new MockMailer().send(email);
  21. }
  22. }
  23. }

相关文章