Skip to content

Commit ff3efaf

Browse files
committed
fix: revert treating some transient SMTP errors as permanent
1 parent 717c18e commit ff3efaf

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

src/smtp.rs

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -244,32 +244,27 @@ pub(crate) async fn smtp_send(
244244
async_smtp::error::Error::Transient(ref response) => {
245245
// We got a transient 4xx response from SMTP server.
246246
// Give some time until the server-side error maybe goes away.
247-
248-
if let Some(first_word) = response.first_word() {
249-
if first_word.ends_with(".1.1")
250-
|| first_word.ends_with(".1.2")
251-
|| first_word.ends_with(".1.3")
252-
{
253-
// Sometimes we receive transient errors that should be permanent.
254-
// Any extended smtp status codes like x.1.1, x.1.2 or x.1.3 that we
255-
// receive as a transient error are misconfigurations of the smtp server.
256-
// See <https://tools.ietf.org/html/rfc3463#section-3.2>
257-
info!(context, "Received extended status code {first_word} for a transient error. This looks like a misconfigured SMTP server, let's fail immediately.");
258-
SendResult::Failure(format_err!("Permanent SMTP error: {}", err))
259-
} else {
260-
info!(
261-
context,
262-
"Transient error with status code {first_word}, postponing retry for later."
263-
);
264-
SendResult::Retry
265-
}
266-
} else {
267-
info!(
268-
context,
269-
"Transient error without status code, postponing retry for later."
270-
);
271-
SendResult::Retry
272-
}
247+
//
248+
// One particular case is
249+
// `450 4.1.2 <alice@example.org>: Recipient address rejected: Domain not found`.
250+
// known to be returned by Postfix.
251+
//
252+
// [RFC 3463](https://tools.ietf.org/html/rfc3463#section-3.2)
253+
// says "This code is only useful for permanent failures."
254+
// in X.1.1, X.1.2 and X.1.3 descriptions.
255+
//
256+
// Previous Delta Chat core versions
257+
// from 1.51.0 to 1.151.1
258+
// were treating such errors as permanent.
259+
//
260+
// This was later reverted because such errors were observed
261+
// for existing domains and turned out to be actually transient,
262+
// likely caused by nameserver downtime.
263+
info!(
264+
context,
265+
"Transient error {response:?}, postponing retry for later."
266+
);
267+
SendResult::Retry
273268
}
274269
_ => {
275270
info!(

0 commit comments

Comments
 (0)