List of usage examples for javax.mail Address getType
public abstract String getType();
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("<", "<").replaceAll(">", ">"); }