|
|
@ -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()
|
|
|
|
let client_security = if CONFIG.smtp_ssl() {
|
|
|
|
.min_protocol_version(Some(Protocol::Tlsv11))
|
|
|
|
let tls = TlsConnector::builder()
|
|
|
|
.build()
|
|
|
|
.min_protocol_version(Some(Protocol::Tlsv11))
|
|
|
|
.unwrap();
|
|
|
|
.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() {
|
|
|
|
if CONFIG.smtp_explicit_tls() {
|
|
|
|
ClientSecurity::Wrapper(tls_params)
|
|
|
|
ClientSecurity::Wrapper(params)
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ClientSecurity::Required(tls_params)
|
|
|
|
ClientSecurity::Required(params)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
ClientSecurity::Opportunistic(tls_params)
|
|
|
|
ClientSecurity::None
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
use std::time::Duration;
|
|
|
|
use std::time::Duration;
|
|
|
|