1
0
Fork 0

Add option to use wrapped TLS in email, instead of STARTTLS upgrade

Dieser Commit ist enthalten in:
Daniel García 2019-03-10 14:44:42 +01:00
Ursprung b4244b28b6
Commit e93538cea9
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: FC8A7D14C3CD543A
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -303,8 +303,10 @@ make_config! {
smtp_host: String, true, option; smtp_host: String, true, option;
/// Enable SSL /// Enable SSL
smtp_ssl: bool, true, def, true; smtp_ssl: bool, true, def, true;
/// Use explicit TLS |> Enabling this would force the use of an explicit TLS connection, instead of upgrading an insecure one with STARTTLS
smtp_explicit_tls: bool, true, def, false;
/// Port /// Port
smtp_port: u16, true, auto, |c| if c.smtp_ssl {587} else {25}; smtp_port: u16, true, auto, |c| if c.smtp_explicit_tls {465} else if c.smtp_ssl {587} else {25};
/// From Address /// From Address
smtp_from: String, true, def, String::new(); smtp_from: String, true, def, String::new();
/// From Name /// From Name

Datei anzeigen

@ -18,7 +18,13 @@ fn mailer() -> SmtpTransport {
.build() .build()
.unwrap(); .unwrap();
ClientSecurity::Required(ClientTlsParameters::new(host.clone(), tls)) let params = ClientTlsParameters::new(host.clone(), tls);
if CONFIG.smtp_explicit_tls() {
ClientSecurity::Wrapper(params)
} else {
ClientSecurity::Required(params)
}
} else { } else {
ClientSecurity::None ClientSecurity::None
}; };