From b9282e7658c50b21e3c23726f8f6f262db79ec9c Mon Sep 17 00:00:00 2001 From: Horváth Zsolt Date: Wed, 12 Oct 2022 23:42:31 +0200 Subject: sink: heed softbounce if SMTP refuses delivery I have a misconfigured MTA server to which I transfer mail from an IMAP account using fetchmail. Although I use the --softbounce switch, fetchmail still deletes the email even in case of unsuccessful delivery. The problem is caused by the fact, that the close_sink() call returns with the value TRUE not only in case of successful delivery, but also in case of a permanent (code 5xx) error. Then the fetch_messages() procedure will no longer know, whether the message can be deleted or not, because it does not have the information that the close_sink() call returned TRUE because the delivery was successful or because it is expected that the delivery will not be successful later either, so the value of the softbounce switch cannot be taken into account at this point. Solution that in the case of a permanent error, the close_sink() call does not return a fixed TRUE value, but the negated value of the softbounce switch. --- sink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sink.c b/sink.c index 85680dbe..d80ec834 100644 --- a/sink.c +++ b/sink.c @@ -1420,7 +1420,7 @@ int close_sink(struct query *ctl, struct msgblk *msg, flag forward) { report(stderr, GT_("SMTP listener refused delivery\n")); smtp_rset(ctl); /* stay on the safe side */ - return(TRUE); + return !run.softbounce; } } -- cgit v1.2.3