changeset 7474:40929ce03622 HEAD

deliver -e: Write the error string to stderr also with tempfails.
author Timo Sirainen <tss@iki.fi>
date Sun, 04 May 2008 03:09:18 +0300
parents 1b15881ed93b
children 4407ef392711
files src/deliver/deliver.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/deliver/deliver.c	Sun May 04 03:00:32 2008 +0300
+++ b/src/deliver/deliver.c	Sun May 04 03:09:18 2008 +0300
@@ -1000,6 +1000,13 @@
 		}
 
 		error_string = mail_storage_get_last_error(storage, &error);
+
+		if (stderr_rejection) {
+			/* write to stderr also for tempfails so that MTA
+			   can log the reason if it wants to. */
+			fprintf(stderr, "%s\n", error_string);
+		}
+
 		if (error != MAIL_ERROR_NOSPACE ||
 		    getenv("QUOTA_FULL_TEMPFAIL") != NULL) {
 			/* Saving to INBOX should always work unless
@@ -1008,14 +1015,12 @@
 			return EX_TEMPFAIL;
 		}
 
+		/* we'll have to reply with permanent failure */
 		deliver_log(mail, "rejected: %s",
 			    str_sanitize(error_string, 512));
 
-		/* we'll have to reply with permanent failure */
-		if (stderr_rejection) {
-			fprintf(stderr, "%s\n", error_string);
+		if (stderr_rejection)
 			return EX_NOPERM;
-		}
 		ret = mail_send_rejection(mail, user, error_string);
 		if (ret != 0)
 			return ret < 0 ? EX_TEMPFAIL : ret;