changeset 9852:1bb29c3fad82 HEAD

lda: Don't send rejects to any messages that have Auto-Submitted header.
author Timo Sirainen <tss@iki.fi>
date Tue, 01 Sep 2009 23:13:04 -0400
parents 27fc3665b4dd
children 2765e7fb2202
files src/lib-lda/mail-send.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-lda/mail-send.c	Tue Sep 01 12:22:46 2009 -0400
+++ b/src/lib-lda/mail-send.c	Tue Sep 01 23:13:04 2009 -0400
@@ -59,11 +59,19 @@
     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);