fix(smtp): use DNS cache for implicit TLS connections

load_cache argument to connect_tcp() should only be false
if strict TLS checks are disabled or TLS is not used.
This commit is contained in:
link2xt
2024-07-24 08:51:04 +00:00
parent 5fb5fd4318
commit d46f53a004

View File

@@ -178,7 +178,7 @@ impl Smtp {
port: u16,
strict_tls: bool,
) -> Result<SmtpTransport<Box<dyn SessionBufStream>>> {
let tcp_stream = connect_tcp(context, hostname, port, SMTP_TIMEOUT, false).await?;
let tcp_stream = connect_tcp(context, hostname, port, SMTP_TIMEOUT, strict_tls).await?;
let tls_stream = wrap_tls(strict_tls, hostname, &["smtp"], tcp_stream).await?;
let buffered_stream = BufStream::new(tls_stream);
let session_stream: Box<dyn SessionBufStream> = Box::new(buffered_stream);