mirror of
https://github.com/chatmail/relay.git
synced 2026-08-10 18:40:51 +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 {
|
||||
Ok(response) => Ok(Response::builder()
|
||||
.status(201)
|
||||
.status(200)
|
||||
.body(Full::new(Bytes::from(response)).boxed())?),
|
||||
Err(e) => Ok(Response::builder()
|
||||
.status(400)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
_ => {
|
||||
|
||||
Reference in New Issue
Block a user