Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions modules/programs/aerc-accounts.nix
Original file line number Diff line number Diff line change
Expand Up @@ -177,21 +177,20 @@ in {
params = cfg.aerc.smtpOauth2Params;
};

protocol = if smtp.tls.enable && !smtp.tls.useStartTls then
"smtps${loginMethod'}"
protocol = if smtp.tls.enable then
if smtp.tls.useStartTls then
"smtp${loginMethod'}"
else
"smtps${loginMethod'}"
else
"smtp${loginMethod'}";
"smtp+insecure${loginMethod'}";

port' = optPort smtp.port;

smtp-starttls =
if smtp.tls.enable && smtp.tls.useStartTls then "yes" else null;

in {
outgoing =
"${protocol}://${userName}@${smtp.host}${port'}${oauthParams'}";
} // optPwCmd "outgoing" passwordCommand
// optAttr "smtp-starttls" smtp-starttls;
} // optPwCmd "outgoing" passwordCommand;

msmtp = cfg: {
outgoing = "msmtpq --read-envelope-from --read-recipients";
Expand Down
5 changes: 2 additions & 3 deletions tests/modules/programs/aerc/extraAccounts.expected
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ source-cred-cmd = echo PaSsWorD!
[e_smtp-nopasscmd-tls-starttls]
from = Foo Bar <addr@mail.invalid>
outgoing = smtp+plain://foobar@smtp.host.invalid:42
smtp-starttls = yes

[f_smtp-passcmd-tls-nostarttls]
from = Foo Bar <addr@mail.invalid>
Expand All @@ -47,12 +46,12 @@ outgoing-cred-cmd = echo PaSsWorD!

[g_smtp-passcmd-notls-nostarttls]
from = Foo Bar <addr@mail.invalid>
outgoing = smtp+plain://foobar@smtp.host.invalid:42
outgoing = smtp+insecure+plain://foobar@smtp.host.invalid:42
outgoing-cred-cmd = echo PaSsWorD!

[h_smtp-passcmd-notls-starttls]
from = Foo Bar <addr@mail.invalid>
outgoing = smtp+plain://foobar@smtp.host.invalid:42
outgoing = smtp+insecure+plain://foobar@smtp.host.invalid:42
outgoing-cred-cmd = echo PaSsWorD!

[i_maildir-mbsync]
Expand Down