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

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

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

MimeMessage.getHeaderAsNewsAddresses介绍

[英]Convert a header into an array of NewsAddress items.
[中]将标题转换为新闻地址项目数组。

代码示例

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

/**
 * Utility routine to merge different recipient types into a
 * single list.
 *
 * @param list   The accumulator list.
 * @param type   The recipient type to extract.
 *
 * @exception MessagingException
 */
private void addRecipientsToList(List list, Message.RecipientType type) throws MessagingException {
  Address[] recipients;
  if (type == RecipientType.NEWSGROUPS) {
    recipients = getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
  }
  else {
    recipients = getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
  }
  if (recipients != null) {
    list.addAll(Arrays.asList(recipients));
  }
}

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

/**
 * Utility routine to merge different recipient types into a
 * single list.
 *
 * @param list   The accumulator list.
 * @param type   The recipient type to extract.
 *
 * @exception MessagingException
 */
private void addRecipientsToList(List list, Message.RecipientType type) throws MessagingException {
  Address[] recipients;
  if (type == RecipientType.NEWSGROUPS) {
    recipients = getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
  }
  else {
    recipients = getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
  }
  if (recipients != null) {
    list.addAll(Arrays.asList(recipients));
  }
}

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

/**
 * Gets the recipients by type.  Returns null if there are no
 * headers of the specified type.  Acceptable RecipientTypes are:
 *
 *   javax.mail.Message.RecipientType.TO
 *   javax.mail.Message.RecipientType.CC
 *   javax.mail.Message.RecipientType.BCC
 *   javax.mail.internet.MimeMessage.RecipientType.NEWSGROUPS
 *
 * @param type   The message RecipientType identifier.
 *
 * @return The array of addresses for the specified recipient types.
 * @exception MessagingException
 */
public Address[] getRecipients(Message.RecipientType type) throws MessagingException {
  // is this a NEWSGROUP request?  We need to handle this as a special case here, because
  // this needs to return NewsAddress instances instead of InternetAddress items.
  if (type == RecipientType.NEWSGROUPS) {
    return getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
  }
  // the other types are all internet addresses.
  return getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
}

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

/**
 * Gets the recipients by type.  Returns null if there are no
 * headers of the specified type.  Acceptable RecipientTypes are:
 *
 *   javax.mail.Message.RecipientType.TO
 *   javax.mail.Message.RecipientType.CC
 *   javax.mail.Message.RecipientType.BCC
 *   javax.mail.internet.MimeMessage.RecipientType.NEWSGROUPS
 *
 * @param type   The message RecipientType identifier.
 *
 * @return The array of addresses for the specified recipient types.
 * @exception MessagingException
 */
public Address[] getRecipients(Message.RecipientType type) throws MessagingException {
  // is this a NEWSGROUP request?  We need to handle this as a special case here, because
  // this needs to return NewsAddress instances instead of InternetAddress items.
  if (type == RecipientType.NEWSGROUPS) {
    return getHeaderAsNewsAddresses(getHeaderForRecipientType(type));
  }
  // the other types are all internet addresses.
  return getHeaderAsInternetAddresses(getHeaderForRecipientType(type), isStrictAddressing());
}

相关文章

MimeMessage类方法