mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 09:26:29 +03:00
fix(smtp): handle failed smtp connections
This commit is contained in:
@@ -133,15 +133,24 @@ impl Smtp {
|
|||||||
lettre::smtp::ClientSecurity::Wrapper(tls_parameters)
|
lettre::smtp::ClientSecurity::Wrapper(tls_parameters)
|
||||||
};
|
};
|
||||||
|
|
||||||
let client = lettre::smtp::SmtpClient::new((domain, port), security)
|
match lettre::smtp::SmtpClient::new((domain, port), security) {
|
||||||
.expect("failed to construct stmp client")
|
Ok(client) => {
|
||||||
.smtp_utf8(true)
|
let client = client
|
||||||
.credentials(creds)
|
.smtp_utf8(true)
|
||||||
.connection_reuse(lettre::smtp::ConnectionReuseParameters::ReuseUnlimited);
|
.credentials(creds)
|
||||||
|
.connection_reuse(lettre::smtp::ConnectionReuseParameters::ReuseUnlimited);
|
||||||
self.transport = Some(client.transport());
|
self.transport = Some(client.transport());
|
||||||
|
1
|
||||||
1
|
}
|
||||||
|
Err(err) => {
|
||||||
|
warn!(
|
||||||
|
context,
|
||||||
|
0,
|
||||||
|
format!("SMTP: failed to establish connection {:?}", err)
|
||||||
|
);
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send<'a>(
|
pub fn send<'a>(
|
||||||
|
|||||||
Reference in New Issue
Block a user