1
0
Fork 0

Merge pull request #901 from sleweke/feature/opportunistic_tls

Use opportunistic TLS in SMTP connections
Dieser Commit ist enthalten in:
Daniel García 2020-03-14 14:41:00 +01:00 committet von GitHub
Commit c6f64d8368
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23

Datei anzeigen

@ -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 tls = TlsConnector::builder()
.min_protocol_version(Some(Protocol::Tlsv11))
.build()
.unwrap();
let tls_params = ClientTlsParameters::new(host.clone(), tls);
let client_security = if CONFIG.smtp_ssl() { let client_security = if CONFIG.smtp_ssl() {
let tls = TlsConnector::builder()
.min_protocol_version(Some(Protocol::Tlsv11))
.build()
.unwrap();
let params = ClientTlsParameters::new(host.clone(), tls);
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;