Log when appropriate if email delivery is skipped

The outgoing mail codepath skips delivery in three different cases:

 * The message body is empty.  This should never happen, so warn.

 * The message has no recipients.  This can happen if all intended
   recipients have been filtered out by the EmailSender, for example
   because none of them has a reasonable preferred email address.
   Log to the info log in this case.

 * The message has no recipients except for the sender.  This is
   perfectly normal, so don't log it.

Change-Id: Iccefd67940e482888d55e65e75eb9c17135ee993
This commit is contained in:
Jonathan Nieder
2013-04-18 14:20:28 -07:00
parent 04621a7bd2
commit 9cf8301e6d

View File

@@ -268,7 +268,7 @@ public abstract class OutgoingEmail {
protected boolean shouldSendMessage() {
if (body.length() == 0) {
// If we have no message body, don't send.
//
log.warn("Skipping delivery of email with no body");
return false;
}
@@ -276,7 +276,7 @@ public abstract class OutgoingEmail {
// If we have nobody to send this message to, then all of our
// selection filters previously for this type of message were
// unable to match a destination. Don't bother sending it.
//
log.info("Skipping delivery of email with no recipients");
return false;
}