/** * Indicates if the message has any recipients. * @return True if the message has recipients. False otherwise. */ public boolean hasRecipients() { return (recipients != null && recipients.size() > 0); }
/** * Indicates if the message has recipients that are not trusted by the address. * @return True if the message has recipients that are not trusted by the address. False otherwise. */ public boolean hasRejectedRecipients() { NHINDAddressCollection rejRecipients = this.getRejectedRecipients(); return (rejRecipients != null && rejRecipients.size() > 0); }
/** * Indicates if the message has recipients that are in the agent's domain. * @return True if the message has recipients that are in the agent's domain. False otherwise. */ public boolean hasDomainRecipients() { NHINDAddressCollection dRecipients = this.getDomainRecipients(); return (dRecipients != null && dRecipients.size() > 0); }
/** * Sets the collection of message recipients. * @param recipients The collection of message recipients. */ protected void setRecipients(NHINDAddressCollection recipients) { if (recipients == null || recipients.size() == 0) throw new AgentException(AgentError.NoRecipients); this.recipients = recipients; }
@Override /** * Converts the collection to a list of addresses compatible with an message routing header message (including the standard delimiter). * @return The collection as an RFC compliant message routing header. */ public String toString() { return InternetAddress.toString(this.toArray(new InternetAddress[this.size()])); }
/** * Removes all addresses from the collection that do not meet the minimum trust status. */ public void removeUntrusted(TrustEnforcementStatus minTrustStatus) { // Remove anybody who is not trusted for (int i = this.size() - 1; i >=0; --i) if (!this.get(i).isTrusted(minTrustStatus)) this.remove(i); }
protected void checkEnvelopeAddresses(NHINDAddressCollection recipients, NHINDAddress sender) { if (recipients == null || recipients.size() == 0) { throw new AgentException(AgentError.NoRecipients); } if (sender == null) { throw new AgentException(AgentError.NoSender); } recipients.setSource(AddressSource.RcptTo); sender.setSource(AddressSource.MailFrom); }
private void postProcessMessage(MessageProcessResult result) { boolean isOutgoing = (result.getProcessedMessage() instanceof OutgoingMessage); // check for rejected recipients if (auditor != null && result.getProcessedMessage().getRejectedRecipients() != null && result.getProcessedMessage().getRejectedRecipients().size() > 0) { Collection<AuditContext> contexts = createContextCollectionFromMessage(result.getProcessedMessage(), Arrays.asList(AuditEvents.DEFAULT_HEADER_CONTEXT)); StringBuffer rejectedRecips = new StringBuffer(); int cnt = 0; for (NHINDAddress address : result.getProcessedMessage().getRejectedRecipients()) { rejectedRecips.append(address.getAddress()); if (++cnt < result.getProcessedMessage().getRejectedRecipients().size()) rejectedRecips.append(", "); } contexts.add(new DefaultAuditContext(AuditEvents.REJECTED_RECIPIENTS_CONTEXT, rejectedRecips.toString())); auditor.audit(PRINICPAL, new AuditEvent(AuditEvents.REJECTED_RECIP_NAME, AuditEvents.EVENT_TYPE), contexts); } if (isOutgoing) postProcessOutgoingMessage(result); else postProcessIncomingMessage(result); }
result.getProcessedMessage().getRejectedRecipients().size() > 0 && smtpMessage.getRecipientAddresses() != null && smtpMessage.getRecipientAddresses().size() > 0)
result.getProcessedMessage().getRejectedRecipients().size() > 0 && mail.getRecipients() != null && mail.getRecipients().size() > 0)
if (rejectedRecipients == null || rejectedRecipients.size() == 0)