try {
Address from = m.getFrom()[0];
String fromAddress;
if (from instanceof InternetAddress)
fromAddress = ((InternetAddress)from).getAddress();
else
fromAddress = from.toString();
StringBuffer sb = new StringBuffer();
fromFmt.format(fromAddress, sb, null);
sb. append(" ");
subjFmt.format(m.getSubject(), sb, null);
return sb.toString();
} catch (Exception e) {
return e.toString();
}