Skip to content

Commit

Permalink
Merge pull request #918 from dani-garcia/revert-901-feature/opportuni…
Browse files Browse the repository at this point in the history
…stic_tls

Revert "Use opportunistic TLS in SMTP connections"
  • Loading branch information
dani-garcia authored Mar 19, 2020
2 parents b85d548 + d2d9fb0 commit 935f386
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/mail.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ use chrono::NaiveDateTime;
fn mailer() -> SmtpTransport {
let host = CONFIG.smtp_host().unwrap();

let tls = TlsConnector::builder()
.min_protocol_version(Some(Protocol::Tlsv11))
.build()
.unwrap();
let client_security = if CONFIG.smtp_ssl() {
let tls = TlsConnector::builder()
.min_protocol_version(Some(Protocol::Tlsv11))
.build()
.unwrap();

let tls_params = ClientTlsParameters::new(host.clone(), tls);
let params = ClientTlsParameters::new(host.clone(), tls);

let client_security = if CONFIG.smtp_ssl() {
if CONFIG.smtp_explicit_tls() {
ClientSecurity::Wrapper(tls_params)
ClientSecurity::Wrapper(params)
} else {
ClientSecurity::Required(tls_params)
ClientSecurity::Required(params)
}
} else {
ClientSecurity::Opportunistic(tls_params)
ClientSecurity::None
};

use std::time::Duration;
Expand Down

0 comments on commit 935f386

Please sign in to comment.