throw new MailBuilderException(message.toString(), e);
}
@Override
public String toString() {
MapBuilder mb = new MapBuilder();
if (getId() != null) {
mb.append("id", getId());
}
mb.append("subject", getSubject());
mb.append("charset", getCharacterEncoding());
mb.append("sentDate", sentDate); // don't use getSentDate()
for (MailAddressType addrType : MailAddressType.values()) {
InternetAddress[] addrs = getAddresses(addrType);
if (isEmptyArray(addrs)) {
mb.append(addrType.name(), EMPTY_STRING);
} else if (addrs.length == 1) {
mb.append(addrType.name(), addrs[0]);
} else {
mb.append(addrType.name(), addrs);
}
}
mb.append("attributes", attributes);
mb.append("content", content);
return new ToStringBuilder().append(getClass().getSimpleName()).append(mb).toString();
}