mirror of
https://github.com/chatmail/relay.git
synced 2026-09-14 11:23:14 +00:00
fix: return HTTP 200 because madmail expects it, and make sure https is immediately retried when SMTP fails (#153)
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
Reference in New Issue
Block a user