Example usage for javax.mail Address getType

List of usage examples for javax.mail Address getType

Introduction

In this page you can find the example usage for javax.mail Address getType.

Prototype

public abstract String getType();

Source Link

Document

Return a type string that identifies this address type.

Usage

From source file:org.jasig.portlet.emailpreview.dao.javamail.JavamailAccountDaoImpl.java

private String getFormattedAddresses(Address[] addresses) {
    List<String> recipientsList = new ArrayList<String>();
    String receiver = null;//  w w  w.java 2 s  .co m
    if (addresses != null && addresses.length != 0) {
        for (Address adress : addresses) {
            if (INTERNET_ADDRESS_TYPE.equals(adress.getType())) {
                InternetAddress inet = (InternetAddress) adress;
                receiver = inet.toUnicodeString();
            } else {
                receiver = adress.toString();
            }
            recipientsList.add(receiver);
        }
    }
    return StringUtils.join(recipientsList, "; ").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
}