]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lda: Don't send rejects to any messages that have Auto-Submitted header.
authorTimo Sirainen <tss@iki.fi>
Wed, 2 Sep 2009 03:13:04 +0000 (23:13 -0400)
committerTimo Sirainen <tss@iki.fi>
Wed, 2 Sep 2009 03:13:04 +0000 (23:13 -0400)
--HG--
branch : HEAD

src/lib-lda/mail-send.c

index 9e3eb2aeb99f12f4303d965073f55a39f9c1a2f1..e29c97cc02b5859128fe292856bf4c6ed54dfbcc 100644 (file)
@@ -59,11 +59,19 @@ int mail_send_rejection(struct mail_deliver_context *ctx, const char *recipient,
     struct message_size hdr_size;
     const char *return_addr, *hdr;
     const unsigned char *data;
-    const char *msgid, *orig_msgid, *boundary;
+    const char *value, *msgid, *orig_msgid, *boundary;
     string_t *str;
     size_t size;
     int ret;
 
+    if (mail_get_first_header(mail, "Auto-Submitted", &value) > 0 &&
+       strcasecmp(value, "no") != 0) {
+           i_info("msgid=%s: Auto-submitted message discarded: %s",
+                  orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80),
+                  str_sanitize(reason, 512));
+           return 0;
+    }
+
     if (mail_get_first_header(mail, "Message-ID", &orig_msgid) < 0)
            orig_msgid = NULL;
     return_addr = mail_deliver_get_return_address(ctx);