Some providers are picky about recipient addresses, they may refuse to
send mails to an address to which mails have previously been rejected
for "550 5.1.1 Bad destination mailbox address".

Sending an RCPT TO command with such an address will fail with these
providers, and result in a non-standard enhanced status code. In this
case, mutt only emits an error like "SMTP session failed: 550 ..."
without mentioning the address associated with the failed command, which
doesn't help much if there are many recipients.

This patch adds extra error log about the recipient address when an RCPT
TO command fails. Users then could easily distinguish the problematic
recipient, and remove it or contact the provider for support.

Signed-off-by: Yao Zi <[email protected]>
---
 smtp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/smtp.c b/smtp.c
index 7880914074d1..dcded4dceadd 100644
--- a/smtp.c
+++ b/smtp.c
@@ -212,7 +212,12 @@ smtp_rcpt_to (CONNECTION * conn, const ADDRESS * a)
     if (mutt_socket_write (conn, buf) == -1)
       return smtp_err_write;
     if ((r = smtp_get_resp (conn)))
+    {
+      mutt_sleep (2);
+      mutt_error (_("SMTP session failed: cannot add recipient <%s>"),
+                  a->mailbox);
       return r;
+    }
     a = a->next;
   }
 
-- 
2.52.0

Reply via email to