javax.mail.internet.MimeMessage.addRecipientsToList()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(133)

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

MimeMessage.addRecipientsToList介绍

[英]Utility routine to merge different recipient types into a single list.
[中]将不同收件人类型合并到单个列表中的实用程序例程。

代码示例

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.3.1_spec

/**
 * Retrieve all of the recipients defined for this message.  This
 * returns a merged array of all possible message recipients
 * extracted from the headers.  The relevant header types are:
 *
 *
 *    javax.mail.Message.RecipientType.TO
 *    javax.mail.Message.RecipientType.CC
 *    javax.mail.Message.RecipientType.BCC
 *    javax.mail.internet.MimeMessage.RecipientType.NEWSGROUPS
 *
 * @return An array of all target message recipients.
 * @exception MessagingException
 */
public Address[] getAllRecipients() throws MessagingException {
  List recipients = new ArrayList();
  addRecipientsToList(recipients, RecipientType.TO);
  addRecipientsToList(recipients, RecipientType.CC);
  addRecipientsToList(recipients, RecipientType.BCC);
  addRecipientsToList(recipients, RecipientType.NEWSGROUPS);
  return (Address[]) recipients.toArray(new Address[recipients.size()]);
}

代码示例来源:origin: org.apache.geronimo.specs/geronimo-javamail_1.4_spec

/**
 * Retrieve all of the recipients defined for this message.  This
 * returns a merged array of all possible message recipients
 * extracted from the headers.  The relevant header types are:
 *
 *
 *    javax.mail.Message.RecipientType.TO
 *    javax.mail.Message.RecipientType.CC
 *    javax.mail.Message.RecipientType.BCC
 *    javax.mail.internet.MimeMessage.RecipientType.NEWSGROUPS
 *
 * @return An array of all target message recipients.
 * @exception MessagingException
 */
public Address[] getAllRecipients() throws MessagingException {
  List recipients = new ArrayList();
  addRecipientsToList(recipients, RecipientType.TO);
  addRecipientsToList(recipients, RecipientType.CC);
  addRecipientsToList(recipients, RecipientType.BCC);
  addRecipientsToList(recipients, RecipientType.NEWSGROUPS);
  // this is supposed to return null if nothing is there.
  if (recipients.isEmpty()) {
    return null;
  }
  return (Address[]) recipients.toArray(new Address[recipients.size()]);
}

相关文章

MimeMessage类方法