20140907 Feature: with "confirm_delay_cleared = yes", Postfix informs the sender when delayed mail leaves the queue. This can result in a sudden burst of notifications at the end of a prolonged network outage, and is therefore disabled by default. diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/mantools/postlink ./mantools/postlink *** /var/tmp/postfix-2.12-20140905-prod/mantools/postlink 2014-07-25 21:26:58.000000000 -0400 --- ./mantools/postlink 2014-09-07 12:01:34.000000000 -0400 *************** *** 127,132 **** --- 127,133 ---- s;\bcommand_expan[-]*\n* *[]*sion_filter\b;$&;g; s;\bcommand_time_limit\b;$&;g; s;\bcon[-]*\n*[ ]*fig_direc[-]*\n*[ ]*tory\b;$&;g; + s;\bconfirm_delay_cleared;$&;g; s;\bcon[-]*\n*[ ]*tent_filter\b;$&;g; s;\bdata_direc[-]*\n*[ ]*tory\b;$&;g; s;\bdae[-]*\n*[ ]*mon_direc[-]*\n*[ ]*tory\b;$&;g; diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/proto/postconf.proto ./proto/postconf.proto *** /var/tmp/postfix-2.12-20140905-prod/proto/postconf.proto 2014-09-07 12:13:26.000000000 -0400 --- ./proto/postconf.proto 2014-09-07 13:20:58.000000000 -0400 *************** *** 7505,7511 ****

The time after which the sender receives a copy of the message ! headers of mail that is still queued.

--- 7505,7512 ----

The time after which the sender receives a copy of the message ! headers of mail that is still queued. The confirm_delay_cleared ! parameter controls sender notification when the delay clears up.

*************** *** 7520,7528 ****

! See also: delay_notice_recipient, notify_classes.

%PARAM disable_dns_lookups no

--- 7521,7540 ----

! See also: delay_notice_recipient, notify_classes, confirm_delay_cleared.

+ %PARAM confirm_delay_cleared no + +

After sending a "your message is delayed" notification, inform + the sender when the delay clears up. This can result in a sudden + burst of notifications at the end of a prolonged network outage, + and is therefore disabled by default.

+ +

See also: delay_warning_time.

+ +

This feature is available in Postfix 2.12 and later.

+ %PARAM disable_dns_lookups no

diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/global/deliver_request.h ./src/global/deliver_request.h *** /var/tmp/postfix-2.12-20140905-prod/src/global/deliver_request.h 2014-07-08 14:35:34.000000000 -0400 --- ./src/global/deliver_request.h 2014-09-07 09:54:10.000000000 -0400 *************** *** 73,78 **** --- 73,79 ---- #define DEL_REQ_FLAG_RECORD (1<<10) /* record and deliver */ #define DEL_REQ_FLAG_CONN_LOAD (1<<11) /* Consult opportunistic cache */ #define DEL_REQ_FLAG_CONN_STORE (1<<12) /* Update opportunistic cache */ + #define DEL_REQ_FLAG_REC_SENT (1<<13) /* Record if sent only */ /* * Cache Load and Store as value or mask. Use explicit _MASK for multi-bit *************** *** 91,97 **** * Mail that uses the trace(8) service, and maybe more. */ #define DEL_REQ_TRACE_FLAGS_MASK \ ! (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD) #define DEL_REQ_TRACE_FLAGS(f) ((f) & DEL_REQ_TRACE_FLAGS_MASK) /* --- 92,99 ---- * Mail that uses the trace(8) service, and maybe more. */ #define DEL_REQ_TRACE_FLAGS_MASK \ ! (DEL_REQ_FLAG_MTA_VRFY | DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD \ ! | DEL_REQ_FLAG_REC_SENT) #define DEL_REQ_TRACE_FLAGS(f) ((f) & DEL_REQ_TRACE_FLAGS_MASK) /* diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/global/mail_params.h ./src/global/mail_params.h *** /var/tmp/postfix-2.12-20140905-prod/src/global/mail_params.h 2014-09-07 12:11:46.000000000 -0400 --- ./src/global/mail_params.h 2014-09-07 12:26:43.000000000 -0400 *************** *** 723,728 **** --- 723,732 ---- #define DEF_DELAY_WARN_TIME "0h" extern int var_delay_warn_time; + #define VAR_DSN_DELAY_CLEARED "confirm_delay_cleared" + #define DEF_DSN_DELAY_CLEARED 0 + extern int var_dsn_delay_cleared; + /* * Queue manager: various in-core message and recipient limits. */ diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/global/sent.c ./src/global/sent.c *** /var/tmp/postfix-2.12-20140905-prod/src/global/sent.c 2014-03-21 08:46:42.000000000 -0400 --- ./src/global/sent.c 2014-09-07 09:49:19.000000000 -0400 *************** *** 32,37 **** --- 32,38 ---- /* The message is a user-requested address expansion probe. /* Update the message delivery record. /* .IP DEL_REQ_FLAG_RECORD + /* .IP DEL_REQ_FLAG_REC_SENT /* This is a normal message with logged delivery. Update the /* the message delivery record. /* .RE .IP queue_id *************** *** 142,148 **** if (my_dsn.action == 0 || my_dsn.action[0] == 0) my_dsn.action = "delivered"; ! if (((flags & DEL_REQ_FLAG_RECORD) == 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)) { --- 143,149 ---- 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 || 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)) { diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/oqmgr/qmgr.c ./src/oqmgr/qmgr.c *** /var/tmp/postfix-2.12-20140905-prod/src/oqmgr/qmgr.c 2013-09-28 21:03:32.000000000 -0400 --- ./src/oqmgr/qmgr.c 2014-09-07 12:36:20.000000000 -0400 *************** *** 290,295 **** --- 290,300 ---- /* .IP "\fBsyslog_name (see 'postconf -d' output)\fR" /* The mail system name that is prepended to the process name in syslog /* records, so that "smtpd" becomes, for example, "postfix/smtpd". + /* .PP + /* Available in Postfix version 2.12 and later: + /* .IP "\fBconfirm_delay_cleared (no)\fR" + /* After sending a "your message is delayed" notification, inform + /* the sender when the delay clears up. /* FILES /* /var/spool/postfix/incoming, incoming queue /* /var/spool/postfix/active, active queue *************** *** 385,390 **** --- 390,396 ---- char *var_def_filter_nexthop; int var_qmgr_daemon_timeout; int var_qmgr_ipc_timeout; + int var_dsn_delay_cleared; static QMGR_SCAN *qmgr_scans[2]; *************** *** 648,653 **** --- 654,660 ---- static const CONFIG_BOOL_TABLE bool_table[] = { VAR_VERP_BOUNCE_OFF, DEF_VERP_BOUNCE_OFF, &var_verp_bounce_off, VAR_CONC_FDBACK_DEBUG, DEF_CONC_FDBACK_DEBUG, &var_conc_feedback_debug, + VAR_DSN_DELAY_CLEARED, DEF_DSN_DELAY_CLEARED, &var_dsn_delay_cleared, 0, }; diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/oqmgr/qmgr_active.c ./src/oqmgr/qmgr_active.c *** /var/tmp/postfix-2.12-20140905-prod/src/oqmgr/qmgr_active.c 2014-07-08 14:27:44.000000000 -0400 --- ./src/oqmgr/qmgr_active.c 2014-09-07 12:36:20.000000000 -0400 *************** *** 385,391 **** * * See also comments in bounce/bounce_notify_util.c. */ ! if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD)) || (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) { atrace_flush(message->tflags, message->queue_name, --- 385,392 ---- * * See also comments in bounce/bounce_notify_util.c. */ ! if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD ! | DEL_REQ_FLAG_REC_SENT)) || (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) { atrace_flush(message->tflags, message->queue_name, diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/oqmgr/qmgr_message.c ./src/oqmgr/qmgr_message.c *** /var/tmp/postfix-2.12-20140905-prod/src/oqmgr/qmgr_message.c 2014-07-10 20:15:48.000000000 -0400 --- ./src/oqmgr/qmgr_message.c 2014-09-07 12:38:46.000000000 -0400 *************** *** 761,766 **** --- 761,776 ---- } /* + * After sending a "delayed" warning, request sender notification when + * message delivery is completed. While "mail delayed" notifications are + * bad enough because they multiply the amount of email traffic, "delay + * cleared" notifications are even worse because they come in a sudden + * burst when the queue drains after a network outage. + */ + if (var_dsn_delay_cleared && message->warn_time < 0) + message->tflags |= DEL_REQ_FLAG_REC_SENT; + + /* * Avoid clumsiness elsewhere in the program. When sending data across an * IPC channel, sending an empty string is more convenient than sending a * null pointer. *************** *** 826,838 **** { /* ! * XXX eventually this should let us schedule multiple warnings, right ! * now it just allows for one. */ if (qmgr_message_open(message) || vstream_fseek(message->fp, message->warn_offset, SEEK_SET) < 0 || rec_fprintf(message->fp, REC_TYPE_WARN, REC_TYPE_WARN_FORMAT, ! REC_TYPE_WARN_ARG(0)) < 0 || vstream_fflush(message->fp)) msg_fatal("update queue file %s: %m", VSTREAM_PATH(message->fp)); qmgr_message_close(message); --- 836,848 ---- { /* ! * After the "mail delayed" warning, optionally send a "delay cleared" ! * notification. */ if (qmgr_message_open(message) || vstream_fseek(message->fp, message->warn_offset, SEEK_SET) < 0 || rec_fprintf(message->fp, REC_TYPE_WARN, REC_TYPE_WARN_FORMAT, ! REC_TYPE_WARN_ARG(-1)) < 0 || vstream_fflush(message->fp)) msg_fatal("update queue file %s: %m", VSTREAM_PATH(message->fp)); qmgr_message_close(message); diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/qmgr/qmgr.c ./src/qmgr/qmgr.c *** /var/tmp/postfix-2.12-20140905-prod/src/qmgr/qmgr.c 2013-09-28 21:03:32.000000000 -0400 --- ./src/qmgr/qmgr.c 2014-09-07 12:32:59.000000000 -0400 *************** *** 336,341 **** --- 336,346 ---- /* .IP "\fBsyslog_name (see 'postconf -d' output)\fR" /* The mail system name that is prepended to the process name in syslog /* records, so that "smtpd" becomes, for example, "postfix/smtpd". + /* .PP + /* Available in Postfix version 2.12 and later: + /* .IP "\fBconfirm_delay_cleared (no)\fR" + /* After sending a "your message is delayed" notification, inform + /* the sender when the delay clears up. /* FILES /* /var/spool/postfix/incoming, incoming queue /* /var/spool/postfix/active, active queue *************** *** 445,450 **** --- 450,456 ---- char *var_def_filter_nexthop; int var_qmgr_daemon_timeout; int var_qmgr_ipc_timeout; + int var_dsn_delay_cleared; static QMGR_SCAN *qmgr_scans[2]; *************** *** 723,728 **** --- 729,735 ---- static const CONFIG_BOOL_TABLE bool_table[] = { VAR_VERP_BOUNCE_OFF, DEF_VERP_BOUNCE_OFF, &var_verp_bounce_off, VAR_CONC_FDBACK_DEBUG, DEF_CONC_FDBACK_DEBUG, &var_conc_feedback_debug, + VAR_DSN_DELAY_CLEARED, DEF_DSN_DELAY_CLEARED, &var_dsn_delay_cleared, 0, }; diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/qmgr/qmgr_active.c ./src/qmgr/qmgr_active.c *** /var/tmp/postfix-2.12-20140905-prod/src/qmgr/qmgr_active.c 2014-07-08 14:27:44.000000000 -0400 --- ./src/qmgr/qmgr_active.c 2014-09-07 11:02:03.000000000 -0400 *************** *** 385,391 **** * * See also comments in bounce/bounce_notify_util.c. */ ! if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD)) || (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) { atrace_flush(message->tflags, message->queue_name, --- 385,392 ---- * * See also comments in bounce/bounce_notify_util.c. */ ! if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD ! | DEL_REQ_FLAG_REC_SENT)) || (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) { atrace_flush(message->tflags, message->queue_name, diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro --exclude=Makefile.in -r -cr /var/tmp/postfix-2.12-20140905-prod/src/qmgr/qmgr_message.c ./src/qmgr/qmgr_message.c *** /var/tmp/postfix-2.12-20140905-prod/src/qmgr/qmgr_message.c 2014-07-10 20:15:18.000000000 -0400 --- ./src/qmgr/qmgr_message.c 2014-09-07 12:28:16.000000000 -0400 *************** *** 802,807 **** --- 802,817 ---- } /* + * After sending a "delayed" warning, request sender notification when + * message delivery is completed. While "mail delayed" notifications are + * bad enough because they multiply the amount of email traffic, "delay + * cleared" notifications are even worse because they come in a sudden + * burst when the queue drains after a network outage. + */ + if (var_dsn_delay_cleared && message->warn_time < 0) + message->tflags |= DEL_REQ_FLAG_REC_SENT; + + /* * Remember when we have read the last recipient batch. Note that we do * it here after reading as reading might have used considerable amount * of time. *************** *** 883,895 **** { /* ! * XXX eventually this should let us schedule multiple warnings, right ! * now it just allows for one. */ if (qmgr_message_open(message) || vstream_fseek(message->fp, message->warn_offset, SEEK_SET) < 0 || rec_fprintf(message->fp, REC_TYPE_WARN, REC_TYPE_WARN_FORMAT, ! REC_TYPE_WARN_ARG(0)) < 0 || vstream_fflush(message->fp)) msg_fatal("update queue file %s: %m", VSTREAM_PATH(message->fp)); qmgr_message_close(message); --- 893,905 ---- { /* ! * After the "mail delayed" warning, optionally send a "delay cleared" ! * notification. */ if (qmgr_message_open(message) || vstream_fseek(message->fp, message->warn_offset, SEEK_SET) < 0 || rec_fprintf(message->fp, REC_TYPE_WARN, REC_TYPE_WARN_FORMAT, ! REC_TYPE_WARN_ARG(-1)) < 0 || vstream_fflush(message->fp)) msg_fatal("update queue file %s: %m", VSTREAM_PATH(message->fp)); qmgr_message_close(message);