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 {
Ok(response) => Ok(Response::builder()
.status(201)
.status(200)
.body(Full::new(Bytes::from(response)).boxed())?),
Err(e) => Ok(Response::builder()
.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
// related to connection.
// (So we don't spam other servers if the message is actually rejected.)
crate::error::Error::Io(io_err) => {
log::warn!("I/O error relaying to mail server {mx_host}: {io_err}");
continue 'try_relay;
}
crate::error::Error::ConnectionFailed(_) => {
log::warn!("Failed to connect to mail server {mx_host}: {error}");
continue 'try_relay;
}
crate::error::Error::Tls(tls_err) => {
log::warn!("TLS error relaying to mail server {mx_host}: {tls_err}");
crate::error::Error::Io(_)
| crate::error::Error::ConnectionFailed(_)
| crate::error::Error::Tls(_) => {
// Make sure we quickly retry HTTP if SMTP failed to connect
mxdeliv_unsupported_hosts.remove(&mx_host).await;
log::warn!(
"Connection error relaying to mail server {mx_host}: {error}"
);
continue 'try_relay;
}
_ => {