mirror of
https://github.com/ViViDboarder/bitwarden_rs.git
synced 2024-11-22 13:16:39 +00:00
Merge pull request #901 from sleweke/feature/opportunistic_tls
Use opportunistic TLS in SMTP connections
This commit is contained in:
commit
c6f64d8368
10
src/mail.rs
10
src/mail.rs
@ -18,21 +18,21 @@ use chrono::NaiveDateTime;
|
|||||||
fn mailer() -> SmtpTransport {
|
fn mailer() -> SmtpTransport {
|
||||||
let host = CONFIG.smtp_host().unwrap();
|
let host = CONFIG.smtp_host().unwrap();
|
||||||
|
|
||||||
let client_security = if CONFIG.smtp_ssl() {
|
|
||||||
let tls = TlsConnector::builder()
|
let tls = TlsConnector::builder()
|
||||||
.min_protocol_version(Some(Protocol::Tlsv11))
|
.min_protocol_version(Some(Protocol::Tlsv11))
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let params = ClientTlsParameters::new(host.clone(), tls);
|
let tls_params = ClientTlsParameters::new(host.clone(), tls);
|
||||||
|
|
||||||
|
let client_security = if CONFIG.smtp_ssl() {
|
||||||
if CONFIG.smtp_explicit_tls() {
|
if CONFIG.smtp_explicit_tls() {
|
||||||
ClientSecurity::Wrapper(params)
|
ClientSecurity::Wrapper(tls_params)
|
||||||
} else {
|
} else {
|
||||||
ClientSecurity::Required(params)
|
ClientSecurity::Required(tls_params)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ClientSecurity::None
|
ClientSecurity::Opportunistic(tls_params)
|
||||||
};
|
};
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
Loading…
Reference in New Issue
Block a user