#825408 reportbug: detect and properly fail if the SMTP server rejected a recipient

#825408#5
Date:
2016-05-26 17:54:30 UTC
From:
To:
Dear Maintainer,

When submitting a bug report, I accidentally used port 25 instead of 587 when
configuring my mailserver. reportbug prompted for a password and authenticated
with the SMTP server. However, as it connected to port 25, my mailserver simply
refused relay access to bugs.debian.org, like it should. It accepted however
the RCPT TO for the copy sent to my own user.

So my mailserver said:

Mai 26 07:33:58 sol.sotecware.net postfix/smtpd[24290]: NOQUEUE: reject: RCPT
from
p200300722F143A00C59AACF7723B93CA.dip0.t-ipconnect.de[2003:72:2f14:3a00:c59a:acf7:723b:93ca]:
554 5.7.1 <submit@bugs.debian.org>: Relay access denied;
from=<jonas@wielicki.name> to=<submit@bugs.debian.org> proto=ESMTP
helo=<sinistra.sotecware.net>

But reportbug did not fail at all, which together with the copy of the mail in
my inbox led me to think that everything was fine. Only after I checked my
server logs after several hours I realised what happened.

reportbug should detect if the mail server refuses one or more recipients and
report that problem properly. Ideally, reportbug would allow re-configuration
of the mailserver in this case and hint that using the SMTP port instead of the
Submission port may be the problem.

#825408#10
Date:
2021-03-31 11:00:18 UTC
From:
To:
I've come across the issue using reportbug 7.5.3~deb10u1.
Misconfiguring (in my case the server config has changed since the last
time I used reportbug) SMTP settings is a user error, but the output is
confusing, which makes the problem hard to notice, i.e. a reportbug
usability issue. See the partial output of my reportbug session below.

	Connecting to <my_server> via SMTP...
	Unable to send report to submit@bugs.debian.org: 554 b'5.7.1 <submit@bugs.debian.org>: Relay access denied'
	Wrote bug report to /tmp/reportbug-claws-mail-vcalendar-plugin-20210331-6084-iewah24q

	Bug report submitted to: Debian Bug Tracking System <submit@bugs.debian.org>
	Copies sent to:
	  [...]

Exit status "0" suggests everything completed successfully. So it would
seem reasonable to assume that "Unable to send" was a temporary error
and a retry succeeded because a further line says "report submitted".
Even though I did notice the error and assumed submission had actually
failed, I still waited for more than an hour to make sure I would not
submit a duplicate report.