fix: return HTTP 200 because madmail expects it, and make sure https is immediately retried when SMTP fails (#153)

This commit is contained in:
holger krekel
2026-05-12 12:13:00 +02:00
committed by GitHub
parent e26cca0260
commit 3896044f36
2 changed files with 9 additions and 11 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ impl<H: SmtpHandler + 'static> Service<Request<Incoming>> for MxDelivService<H>
match handler.handle_data(&mut envelope).await { match handler.handle_data(&mut envelope).await {
Ok(response) => Ok(Response::builder() Ok(response) => Ok(Response::builder()
.status(201) .status(200)
.body(Full::new(Bytes::from(response)).boxed())?), .body(Full::new(Bytes::from(response)).boxed())?),
Err(e) => Ok(Response::builder() Err(e) => Ok(Response::builder()
.status(400) .status(400)
+8 -10
View File
@@ -247,16 +247,14 @@ impl TransportHandler {
// We only want to try other MX hosts if we encounter a problem // We only want to try other MX hosts if we encounter a problem
// related to connection. // related to connection.
// (So we don't spam other servers if the message is actually rejected.) // (So we don't spam other servers if the message is actually rejected.)
crate::error::Error::Io(io_err) => { crate::error::Error::Io(_)
log::warn!("I/O error relaying to mail server {mx_host}: {io_err}"); | crate::error::Error::ConnectionFailed(_)
continue 'try_relay; | crate::error::Error::Tls(_) => {
} // Make sure we quickly retry HTTP if SMTP failed to connect
crate::error::Error::ConnectionFailed(_) => { mxdeliv_unsupported_hosts.remove(&mx_host).await;
log::warn!("Failed to connect to mail server {mx_host}: {error}"); log::warn!(
continue 'try_relay; "Connection error relaying to mail server {mx_host}: {error}"
} );
crate::error::Error::Tls(tls_err) => {
log::warn!("TLS error relaying to mail server {mx_host}: {tls_err}");
continue 'try_relay; continue 'try_relay;
} }
_ => { _ => {