本文整理了Java中org.apache.commons.mail.Email.setTo()
方法的一些代码示例,展示了Email.setTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Email.setTo()
方法的具体详情如下:
包路径:org.apache.commons.mail.Email
类名称:Email
方法名:setTo
[英]Set a list of "TO" addresses. All elements in the specified Collection
are expected to be of type java.mail.internet.InternetAddress
.
[中]设置“收件人”地址列表。指定Collection
中的所有元素应为java.mail.internet.InternetAddress
类型。
代码示例来源:origin: jooby-project/jooby
ifset("startTLSRequired", p -> email.setStartTLSRequired(mail.getBoolean(p)));
ifset("subject", p -> email.setSubject(mail.getString(p)));
ifset("to", p -> email.setTo(address(strList(p))));
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
@Override
public List<InternetAddress> sendEmail(final String templatePath, final Map<String, String> emailParams,
final InternetAddress... recipients) {
List<InternetAddress> failureList = new ArrayList<InternetAddress>();
if (recipients == null || recipients.length <= 0) {
throw new IllegalArgumentException(MSG_INVALID_RECIPIENTS);
}
final MailTemplate mailTemplate = this.getMailTemplate(templatePath);
final Class<? extends Email> mailType = this.getMailType(templatePath);
final MessageGateway<Email> messageGateway = messageGatewayService.getGateway(mailType);
for (final InternetAddress address : recipients) {
try {
// Get a new email per recipient to avoid duplicate attachments
final Email email = getEmail(mailTemplate, mailType, emailParams);
email.setTo(Collections.singleton(address));
messageGateway.send(email);
} catch (Exception e) {
failureList.add(address);
log.error("Error sending email to [ " + address + " ]", e);
}
}
return failureList;
}
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
email.setTo(Collections.singleton(address));
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-commons
email.setTo(Collections.singleton(address));
代码示例来源:origin: com.adobe.acs/acs-aem-commons-bundle
@Override
public List<InternetAddress> sendEmail(final String templatePath, final Map<String, String> emailParams,
final InternetAddress... recipients) {
List<InternetAddress> failureList = new ArrayList<InternetAddress>();
if (recipients == null || recipients.length <= 0) {
throw new IllegalArgumentException("Invalid Recipients");
}
final MailTemplate mailTemplate = this.getMailTemplate(templatePath);
final Class<? extends Email> mailType = this.getMailType(templatePath);
final MessageGateway<Email> messageGateway = messageGatewayService.getGateway(mailType);
for (final InternetAddress address : recipients) {
try {
// Get a new email per recipient to avoid duplicate attachments
final Email email = getEmail(mailTemplate, mailType, emailParams);
email.setTo(Collections.singleton(address));
messageGateway.send(email);
} catch (Exception e) {
failureList.add(address);
log.error("Error sending email to [ " + address + " ]", e);
}
}
return failureList;
}
代码示例来源:origin: org.jooby/jooby-commons-email
ifset("startTLSRequired", p -> email.setStartTLSRequired(mail.getBoolean(p)));
ifset("subject", p -> email.setSubject(mail.getString(p)));
ifset("to", p -> email.setTo(address(strList(p))));
内容来源于网络,如有侵权,请联系作者删除!