com.fsck.k9.mail.Message.setRecipients()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(225)

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

Message.setRecipients介绍

暂无

代码示例

代码示例来源:origin: k9mail/k-9

public void setRecipient(RecipientType type, Address address) {
  setRecipients(type, new Address[] {
           address
         });
}

代码示例来源:origin: k9mail/k-9

@Override
public void sendMessage(Message message) throws MessagingException {
  List<Address> addresses = new ArrayList<>();
  {
    addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.TO)));
    addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.CC)));
    addresses.addAll(Arrays.asList(message.getRecipients(RecipientType.BCC)));
  }
  message.setRecipients(RecipientType.BCC, null);
  Map<String, List<String>> charsetAddressesMap = new HashMap<>();
  for (Address address : addresses) {
    String addressString = address.getAddress();
    String charset = CharsetSupport.getCharsetFromAddress(addressString);
    List<String> addressesOfCharset = charsetAddressesMap.get(charset);
    if (addressesOfCharset == null) {
      addressesOfCharset = new ArrayList<>();
      charsetAddressesMap.put(charset, addressesOfCharset);
    }
    addressesOfCharset.add(addressString);
  }
  for (Map.Entry<String, List<String>> charsetAddressesMapEntry :
      charsetAddressesMap.entrySet()) {
    String charset = charsetAddressesMapEntry.getKey();
    List<String> addressesOfCharset = charsetAddressesMapEntry.getValue();
    message.setCharset(charset);
    sendMessageTo(addressesOfCharset, message);
  }
}

代码示例来源:origin: jberkel/sms-backup-plus

msg.setRecipient(Message.RecipientType.TO, userAddress);
} else {
  msg.setRecipients(Message.RecipientType.TO, details.getAddresses());
  msg.setFrom(userAddress);

相关文章