mirror of
https://github.com/chatmail/core.git
synced 2026-04-26 18:06:35 +03:00
fix: revert treating some transient SMTP errors as permanent
This commit is contained in:
39
src/smtp.rs
39
src/smtp.rs
@@ -244,33 +244,28 @@ pub(crate) async fn smtp_send(
|
|||||||
async_smtp::error::Error::Transient(ref response) => {
|
async_smtp::error::Error::Transient(ref response) => {
|
||||||
// We got a transient 4xx response from SMTP server.
|
// We got a transient 4xx response from SMTP server.
|
||||||
// Give some time until the server-side error maybe goes away.
|
// Give some time until the server-side error maybe goes away.
|
||||||
|
//
|
||||||
if let Some(first_word) = response.first_word() {
|
// One particular case is
|
||||||
if first_word.ends_with(".1.1")
|
// `450 4.1.2 <alice@example.org>: Recipient address rejected: Domain not found`.
|
||||||
|| first_word.ends_with(".1.2")
|
// known to be returned by Postfix.
|
||||||
|| first_word.ends_with(".1.3")
|
//
|
||||||
{
|
// [RFC 3463](https://tools.ietf.org/html/rfc3463#section-3.2)
|
||||||
// Sometimes we receive transient errors that should be permanent.
|
// says "This code is only useful for permanent failures."
|
||||||
// Any extended smtp status codes like x.1.1, x.1.2 or x.1.3 that we
|
// in X.1.1, X.1.2 and X.1.3 descriptions.
|
||||||
// receive as a transient error are misconfigurations of the smtp server.
|
//
|
||||||
// See <https://tools.ietf.org/html/rfc3463#section-3.2>
|
// Previous Delta Chat core versions
|
||||||
info!(context, "Received extended status code {first_word} for a transient error. This looks like a misconfigured SMTP server, let's fail immediately.");
|
// from 1.51.0 to 1.151.1
|
||||||
SendResult::Failure(format_err!("Permanent SMTP error: {}", err))
|
// were treating such errors as permanent.
|
||||||
} else {
|
//
|
||||||
|
// This was later reverted because such errors were observed
|
||||||
|
// for existing domains and turned out to be actually transient,
|
||||||
|
// likely caused by nameserver downtime.
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
"Transient error with status code {first_word}, postponing retry for later."
|
"Transient error {response:?}, postponing retry for later."
|
||||||
);
|
);
|
||||||
SendResult::Retry
|
SendResult::Retry
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
info!(
|
|
||||||
context,
|
|
||||||
"Transient error without status code, postponing retry for later."
|
|
||||||
);
|
|
||||||
SendResult::Retry
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_ => {
|
_ => {
|
||||||
info!(
|
info!(
|
||||||
context,
|
context,
|
||||||
|
|||||||
Reference in New Issue
Block a user