neomutt: fix STARTTLS

When smtps is used as a protocol, neomutt expects TLS but will if
STARTTLS should be used. When using STARTTLS, smtp has to be used as
protocol and `ssl_force_tls` is set.

See <https://neomutt.org/guide/optionalfeatures#2-1-%C2%A0starttls>.
This commit is contained in:
Franz Pletz 2023-08-29 23:56:29 +02:00 committed by Robert Helgesson
parent 0ed5f9786b
commit 408ba13188
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
4 changed files with 85 additions and 2 deletions

View file

@ -118,7 +118,8 @@ let
sendmail = "'${neomutt.sendMailCommand}'";
} else
let
smtpProto = if smtp.tls.enable then "smtps" else "smtp";
smtpProto =
if smtp.tls.enable && !smtp.tls.useStartTls then "smtps" else "smtp";
smtpPort = if smtp.port != null then ":${toString smtp.port}" else "";
smtpBaseUrl =
"${smtpProto}://${escape userName}@${smtp.host}${smtpPort}";
@ -217,7 +218,9 @@ let
}";
in ''
# Generated by Home Manager.
set ssl_force_tls = yes
set ssl_force_tls = ${
lib.hm.booleans.yesNo (smtp.tls.enable || smtp.tls.useStartTls)
}
set certificate_file=${toString config.accounts.email.certificatesFile}
# GPG section