commit c6f64d8368b1a9e71d301fd3191bf419a6f69256 parent edabf19ddfb83ae435f6b58e668b08a832f9b1fc Author: Daniel GarcĂa <dani-garcia@users.noreply.github.com> Date: Sat, 14 Mar 2020 14:41:00 +0100 Merge pull request #901 from sleweke/feature/opportunistic_tls Use opportunistic TLS in SMTP connections Diffstat:
M | src/mail.rs | | | 18 | +++++++++--------- |
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/mail.rs b/src/mail.rs @@ -18,21 +18,21 @@ use chrono::NaiveDateTime; fn mailer() -> SmtpTransport { let host = CONFIG.smtp_host().unwrap(); - let client_security = if CONFIG.smtp_ssl() { - let tls = TlsConnector::builder() - .min_protocol_version(Some(Protocol::Tlsv11)) - .build() - .unwrap(); + let tls = TlsConnector::builder() + .min_protocol_version(Some(Protocol::Tlsv11)) + .build() + .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() { - ClientSecurity::Wrapper(params) + ClientSecurity::Wrapper(tls_params) } else { - ClientSecurity::Required(params) + ClientSecurity::Required(tls_params) } } else { - ClientSecurity::None + ClientSecurity::Opportunistic(tls_params) }; use std::time::Duration;