use of org.nhindirect.stagent.AddressSource in project nhin-d by DirectProject.
the class AbstractNotificationAwareMailet method getMailRecipients.
/**
* Get the recipients of Mail 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
*/
@SuppressWarnings("unchecked")
protected NHINDAddressCollection getMailRecipients(Mail mail) throws MessagingException {
final NHINDAddressCollection recipients = new NHINDAddressCollection();
// uses the RCPT TO commands
final Collection<MailAddress> recips = mail.getRecipients();
if (recips == null || recips.size() == 0) {
// fall back to the mime message list of recipients
final Address[] recipsAddr = mail.getMessage().getAllRecipients();
for (Address addr : recipsAddr) {
recipients.add(new NHINDAddress(addr.toString(), (AddressSource) null));
}
} else {
for (MailAddress addr : recips) {
recipients.add(new NHINDAddress(addr.toString(), (AddressSource) null));
}
}
return recipients;
}
use of org.nhindirect.stagent.AddressSource in project nhin-d by DirectProject.
the class ReliableDispatchedNotificationProducer_produceTest method getMailRecipients.
protected NHINDAddressCollection getMailRecipients(MimeMessage mail) throws MessagingException {
final NHINDAddressCollection recipients = new NHINDAddressCollection();
final Address[] recipsAddr = mail.getAllRecipients();
for (Address addr : recipsAddr) {
recipients.add(new NHINDAddress(addr.toString(), (AddressSource) null));
}
return recipients;
}
Aggregations