/** * Gets a list of recipients in the message that are not trusted by the address. * @return A list of recipients in the message that are not trusted by the address. */ public NHINDAddressCollection getRejectedRecipients() { if (this.rejectedRecipients == null) { this.rejectedRecipients = new NHINDAddressCollection(); } return rejectedRecipients; }
/** * Generates an instance of an NHINDAddressCollection from a collection of NHINDAddress addresses. * @param source A collection of NHINDAddress addresses to seed this object with. * @return n instance of an NHINDAddressCollection object containing all of the source addresses. */ public static NHINDAddressCollection create(Collection<NHINDAddress> source) { NHINDAddressCollection addresses = new NHINDAddressCollection(); addresses.addAll(source); return addresses; }
/** * Splits recipients into domain recipients and external recipients. The agent's domains are used to determine a recipients category. * @param domain A collection of local domains supported by the agent. */ protected void categorizeRecipients(Collection<String> domains) { if (domains == null || domains.size() == 0) { throw new IllegalArgumentException(); } NHINDAddressCollection recipients = this.getRecipients(); this.domainRecipients = new NHINDAddressCollection(); this.otherRecipients = new ArrayList<NHINDAddress>(); for (NHINDAddress address : recipients) { if (address.isInDomain(domains)) { this.domainRecipients.add(address); } else { this.otherRecipients.add(address); } } }
NHINDAddressCollection retVal = new NHINDAddressCollection();
/** * Get the recipients of a message by retrieving the recipient list from the SMTP envelope first, then falling back to the recipients * in the message if the recipients cannot be retrieved from the SMTP envelope. * @param mail The mail object that contains information from the SMTP envelope. * @return Collection of message recipients. * @throws MessagingException */ public static NHINDAddressCollection getMailRecipients(SMTPMailMessage mail) throws MessagingException { final NHINDAddressCollection recipients = new NHINDAddressCollection(); // uses the RCPT TO commands final Collection<InternetAddress> recips = mail.getRecipientAddresses(); if (recips == null || recips.size() == 0) { // fall back to the mime message list of recipients final Address[] recipsAddr = mail.getMimeMessage().getAllRecipients(); for (Address addr : recipsAddr) { recipients.add(new NHINDAddress(addr.toString(), (AddressSource)null)); } } else for (InternetAddress addr : recips) recipients.add(new NHINDAddress(addr)); return recipients; }
final NHINDAddressCollection xdRecipients = new NHINDAddressCollection(); final MimeMessage msg = smtpMailMessage.getMimeMessage();
/** * Creates a collection of recipients based on the TO, CC, and BCC headers in the wrapped message. * @return A collection of recipients. */ protected NHINDAddressCollection collectRecipients() { NHINDAddressCollection addresses = new NHINDAddressCollection(); if (this.getTo() != null) { addresses.addAll(this.getTo()); } if (this.getCC() != null) { addresses.addAll(this.getCC()); } if (this.getBCC() != null) { addresses.addAll(this.getBCC()); } return addresses; }