Wietse Venema: > > 3) sender did not request "DELAY" notification > > -> relay should not send a "relayed" (after delay) > > I looked at the code, and while the existing "delayed" notifications > can be suppressed with NOTIFY=FAILURE (i.e. without "DELAY"), it > looks like the new "relayed" (after delay) notifications ignore > that. So that still needs to be fixed.
This is a minimal patch relative to the confirm_delay_cleared patch. This suppresses the notification when the user requests NOTIFY=FAILURE, or any NOTIFY features that do not include DELAY. Wietse --- /var/tmp/postfix-2.12-20140921/src/global/sent.c 2014-09-07 09:49:19.000000000 -0400 +++ ./sent.c 2014-09-22 17:12:45.000000000 -0400 @@ -140,10 +140,19 @@ * Normal mail delivery. May also send a delivery record to the user. */ else { + + /* + * Readability macros: record all deliveries, or delayed deliveries. + */ +#define REC_ALL_SENT(flags) (flags & DEL_REQ_FLAG_RECORD) +#define REC_DLY_SENT(flags, rcpt) \ + ((flags & DEL_REQ_FLAG_REC_SENT) \ + && (rcpt->dsn_notify == 0 || (rcpt->dsn_notify & DSN_NOTIFY_DELAY))) + if (my_dsn.action == 0 || my_dsn.action[0] == 0) my_dsn.action = "delivered"; - if (((flags & (DEL_REQ_FLAG_RECORD | DEL_REQ_FLAG_REC_SENT)) == 0 + if (((REC_ALL_SENT(flags) == 0 && REC_DLY_SENT(flags, recipient) == 0) || trace_append(flags, id, stats, recipient, relay, &my_dsn) == 0) && ((recipient->dsn_notify & DSN_NOTIFY_SUCCESS) == 0 || trace_append(flags, id, stats, recipient, relay, &my_dsn) == 0)) {