Michel S?bastien:
> Hi all.
> I use LMTP transport to deliver mails into Cyrus and when asking
> DSN success I got an action "relayed".
Besides final delivery, LMTP is also used to deliver mail into
content filters. The advantage of LMTP is that the protocol reports
one end-of-message status for each recipient.
To avoid breaking delivery status notifications with content filters,
this change would have to be configurable with the default being
backwards compatible.
As a simple heuristic, we could look at the LMTP server's LHLO
response.
- If the LMTP server announces DSN support then we know for sure
that it is not doing final delivery.
- If the LMTP server does not announce DSN support, then either it
does final delivery, or it is poorly-implemented content filter.
In terms of code, this would look like:
if (session->features & SMTP_FEATURE_DSN) {
/* delivery via pass-through content filter */
rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;
dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
} else if (var_lmtp_assume_final == 0) {
/* backwards compatible */
dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
} else {
/* assume final delivery */
dsb_update(why, resp->dsn, "delivered", DSB_MTYPE_DNS, session->host,
DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
}
This is the safest approach.
Wietse
> *** src/smtp/smtp_rcpt.c 2006-01-07 21:16:40.000000000 +0000
> --- src/smtp/smtp_rcpt.c.1 2009-02-12 17:32:42.000000000 +0000
> ***************
> *** 144,150 ****
> if (session->features & SMTP_FEATURE_DSN)
> rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;
>
> ! dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
> DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
>
> status = sent(DEL_REQ_TRACE_FLAGS(request->flags),
> --- 144,151 ----
> if (session->features & SMTP_FEATURE_DSN)
> rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;
>
> ! dsb_update(why, resp->dsn, (state->misc_flags &
> SMTP_MISC_FLAG_USE_LMTP) ? "delivered" : "relayed",
> ! DSB_MTYPE_DNS, session->host,
> DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
>
> status = sent(DEL_REQ_TRACE_FLAGS(request->flags),