dovecot-2.1: lib-lda: Send DSN only for out-of-quota errors. Sen...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Feb 12 18:26:49 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/ad5298ba3229
changeset: 14132:ad5298ba3229
user: Timo Sirainen <tss at iki.fi>
date: Sun Feb 12 18:26:22 2012 +0200
description:
lib-lda: Send DSN only for out-of-quota errors. Send MDN for Sieve rejects.
diffstat:
src/lda/main.c | 1 +
src/lib-lda/mail-deliver.h | 2 ++
src/lib-lda/mail-send.c | 45 ++++++++++++++++++++++++++++++++-------------
3 files changed, 35 insertions(+), 13 deletions(-)
diffs (86 lines):
diff -r b9e74767cd39 -r ad5298ba3229 src/lda/main.c
--- a/src/lda/main.c Sun Feb 12 07:25:40 2012 +0200
+++ b/src/lda/main.c Sun Feb 12 18:26:22 2012 +0200
@@ -454,6 +454,7 @@
return EX_TEMPFAIL;
}
ctx.mailbox_full = TRUE;
+ ctx.dsn = TRUE;
/* we'll have to reply with permanent failure */
mail_deliver_log(&ctx, "rejected: %s",
diff -r b9e74767cd39 -r ad5298ba3229 src/lib-lda/mail-deliver.h
--- a/src/lib-lda/mail-deliver.h Sun Feb 12 07:25:40 2012 +0200
+++ b/src/lib-lda/mail-deliver.h Sun Feb 12 18:26:22 2012 +0200
@@ -53,6 +53,8 @@
bool save_dest_mail;
/* Delivery failed because user is out of quota / disk space */
bool mailbox_full;
+ /* Send DSN instead of MDN */
+ bool dsn;
};
struct mail_deliver_save_open_context {
diff -r b9e74767cd39 -r ad5298ba3229 src/lib-lda/mail-send.c
--- a/src/lib-lda/mail-send.c Sun Feb 12 07:25:40 2012 +0200
+++ b/src/lib-lda/mail-send.c Sun Feb 12 18:26:22 2012 +0200
@@ -99,8 +99,10 @@
fprintf(f, "To: <%s>\r\n", return_addr);
fprintf(f, "MIME-Version: 1.0\r\n");
fprintf(f, "Content-Type: "
- "multipart/report; report-type=delivery-status;\r\n"
- "\tboundary=\"%s\"\r\n", boundary);
+ "multipart/report; report-type=%s;\r\n"
+ "\tboundary=\"%s\"\r\n",
+ ctx->dsn ? "delivery-status" : "disposition-notification",
+ boundary);
str = t_str_new(256);
var_expand(str, ctx->set->rejection_subject,
@@ -122,18 +124,35 @@
get_var_expand_table(mail, reason, recipient));
fprintf(f, "%s\r\n", str_c(str));
- /* DSN status report */
- fprintf(f, "--%s\r\n"
- "Content-Type: message/delivery-status\r\n\r\n",
- boundary);
- fprintf(f, "Reporting-MTA: dns; %s\r\n",
- ctx->set->hostname);
- if (mail_get_first_header(mail, "Original-Recipient", &hdr) > 0)
- fprintf(f, "Original-Recipient: rfc822; %s\r\n", hdr);
- fprintf(f, "Final-Recipient: rfc822; %s\r\n", recipient);
+ if (ctx->dsn) {
+ /* DSN status report: For LDA rejects. currently only used when
+ user is out of quota */
+ fprintf(f, "--%s\r\n"
+ "Content-Type: message/delivery-status\r\n\r\n",
+ boundary);
+ fprintf(f, "Reporting-MTA: dns; %s\r\n",
+ ctx->set->hostname);
+ if (mail_get_first_header(mail, "Original-Recipient", &hdr) > 0)
+ fprintf(f, "Original-Recipient: rfc822; %s\r\n", hdr);
+ fprintf(f, "Final-Recipient: rfc822; %s\r\n", recipient);
+ fprintf(f, "Action: failed\r\n");
+ fprintf(f, "Status: %s\r\n", ctx->mailbox_full ? "5.2.2" : "5.2.0");
+ } else {
+ /* MDN status report: For Sieve "reject" */
+ fprintf(f, "--%s\r\n"
+ "Content-Type: message/disposition-notification\r\n\r\n",
+ boundary);
+ fprintf(f, "Reporting-UA: %s; Dovecot Mail Delivery Agent\r\n",
+ ctx->set->hostname);
+ if (mail_get_first_header(mail, "Original-Recipient", &hdr) > 0)
+ fprintf(f, "Original-Recipient: rfc822; %s\r\n", hdr);
+ fprintf(f, "Final-Recipient: rfc822; %s\r\n", recipient);
- fprintf(f, "Action: failed\r\n");
- fprintf(f, "Status: %s\r\n", ctx->mailbox_full ? "5.2.2" : "5.2.0");
+ if (orig_msgid != NULL)
+ fprintf(f, "Original-Message-ID: %s\r\n", orig_msgid);
+ fprintf(f, "Disposition: "
+ "automatic-action/MDN-sent-automatically; deleted\r\n");
+ }
fprintf(f, "\r\n");
/* original message's headers */
More information about the dovecot-cvs
mailing list