]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lda: mail_send_rejection() logs permanent rejections now with info level.
authorTimo Sirainen <tss@iki.fi>
Fri, 25 Apr 2014 12:57:03 +0000 (15:57 +0300)
committerTimo Sirainen <tss@iki.fi>
Fri, 25 Apr 2014 12:57:03 +0000 (15:57 +0300)
There's no need to log an error when return-path is invalid.

src/lib-lda/mail-send.c

index a570e88ec9844e447f724035b1d871d8397c1118..f0b16cce0be54adbd6e8fd5c625fbb21b0bbbc6f 100644 (file)
@@ -58,7 +58,7 @@ int mail_send_rejection(struct mail_deliver_context *ctx, const char *recipient,
     struct smtp_client *smtp_client;
     struct ostream *output;
     const char *return_addr, *hdr;
-    const char *value, *msgid, *orig_msgid, *boundary;
+    const char *value, *msgid, *orig_msgid, *boundary, *error;
     string_t *str;
     int ret;
 
@@ -180,5 +180,14 @@ int mail_send_rejection(struct mail_deliver_context *ctx, const char *recipient,
     str_truncate(str, 0);
     str_printfa(str, "\r\n\r\n--%s--\r\n", boundary);
     o_stream_nsend(output, str_data(str), str_len(str));
-    return smtp_client_close(smtp_client);
+    if ((ret = smtp_client_deinit(smtp_client, &error)) < 0) {
+           i_error("msgid=%s: Temporarily failed to send rejection: %s",
+                   orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80),
+                   str_sanitize(error, 512));
+    } else if (ret == 0) {
+           i_info("msgid=%s: Permanently failed to send rejection: %s",
+                  orig_msgid == NULL ? "" : str_sanitize(orig_msgid, 80),
+                  str_sanitize(error, 512));
+    }
+    return ret < 0 ? -1 : 0;
 }