您的位置:首页 > 其它

6.9.4 qmgr_active_done_25_generic函数:发送退信或延迟提醒信

2016-04-07 15:41 387 查看
/qmgr/qmgr_active.c
425 /* qmgr_active_done_25_generic -continue processing */
426
427 static voidqmgr_active_done_25_generic(QMGR_MESSAGE *message)
428 {
429    const char *myname = "qmgr_active_done_25_generic";
430
431    /*
432     * If we get to this point we have tried all recipients for this message.
433     * If the message is too old, try to bounce it.
434     *
435     * Bounces are sent asynchronously to avoid stalling while the cleanup
436     * daemon waits for the qmgr to accept the "new mail" trigger.
437     */
438    if (message->flags) {
439        if (event_time() >= message->create_time +
440             (*message->sender ?var_max_queue_time : var_dsn_queue_time)) {
441             msg_info("%s:from=<%s>, status=expired, returned to sender",
442                      message->queue_id,message->sender);
443             if (message->verp_delims == 0|| var_verp_bounce_off)
444                 adefer_flush(BOUNCE_FLAG_KEEP,
//参数
454             else
455                adefer_flush_verp(BOUNCE_FLAG_KEEP,
//参数
466             return;


439-466 确定邮件是否过期,过期则发送退信

var_max_queue_time即参数maximal_queue_lifetime,表示邮件在等待队列里的最长时间。var_dsn_queue_time 即参数bounce_queue_lifetime,表示退信发送的期限上限。

这两个参数的默认值均为5天。

如果邮件存在发件人,说明是延迟邮件,采用参数maximal_queue_lifetime参与计算。系统生成的邮件没有发件人,对于没有发件人的给用户的通知邮件,postfix会将收件人设置为MAILER-DEMON。见7.5节。

如果当前时间大于邮件入队时间和参数时间之和,说明邮件已过期,采用adefer_flush或adefer_flush_verp发送退信。adefer_flush或adefer_flush_verp使用BOUNCE_CMD_FLUSH命令调用bounce模块的bounce_notify_service函数。

467        } else if (message->warn_time > 0
468                    && event_time()>= message->warn_time - 1) {
469             if (msg_verbose)
470                 msg_info("%s: sendingdefer warning for %s", myname, message->queue_id);
471            adefer_warn(BOUNCE_FLAG_KEEP,
//参数
481             return;
482        }
483    }
484
485    /*
486     * Asynchronous processing does not reach this point.
487     */
488    qmgr_active_done_3_generic(message);
489 }


467-482 如果设定了QMGR_MESSAGE->warn_time字段,即发送延迟提醒信的时间,并且该时间已过期,则使用adefer_warn函数发送延迟提醒信。该函数以BOUNCE_CMD_WARN命令调用bounce模块的bounce_warn_service函数。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: