/** * Parse the headerValue and delegate to {@link #getDisplayAddress(Mailbox)} * * <p>If no display address is found an empty String is returned * * @param headerValue * @return display */ public static String getDisplayAddress(String headerValue) { AddressList addressList = LenientAddressParser.DEFAULT.parseAddressList(MimeUtil.unfold(headerValue)); if (addressList != null && addressList.isEmpty() == false) { Address address = addressList.get(0); if (address instanceof Mailbox) { return getDisplayAddress((Mailbox) address); } else if (address instanceof Group) { Group group = (Group) address; if (group != null) { MailboxList mList = group.getMailboxes(); if (mList != null && mList.isEmpty() == false) { return getDisplayAddress(mList.get(0)); } } } } return ""; }