mail: Add tu-dreden account

Special thanks to whoever thought that a backslash in a user name is a
good idea.
This commit is contained in:
Simon Bruder 2022-07-29 08:28:57 +02:00
parent 5bb1d42abe
commit d66cf000b0
Signed by: simon
GPG key ID: 8D3C82F9F309F8EC
2 changed files with 34 additions and 2 deletions

View file

@ -78,6 +78,33 @@ in
signature.text = signaturePersonal;
aerc.enable = true;
};
tu-dresden = rec {
realName = "Simon Bruder";
address = "simon.bruder@mailbox.tu-dresden.de";
userName = "user\\sibr833e";
passwordCommand = "pass web/tu-dresden.de | head -n 1";
imap = {
host = "msx.tu-dresden.de";
tls.useStartTls = true;
};
smtp = {
host = "msx.tu-dresden.de";
port = 587;
tls.useStartTls = true;
};
gpg = {
key = config.programs.gpg.settings.default-key;
signByDefault = true;
encryptByDefault = true;
};
signature.text = signaturePersonal;
aerc.enable = true;
};
};

View file

@ -19,7 +19,12 @@ in
"aerc/accounts.conf".text = lib.generators.toINI { } (lib.mapAttrs
# incomplete support for all configuration options!
(name: accountConfig: with accountConfig; let
quoteMailAddress = lib.replaceChars [ "@" ] [ "%40" ];
quoteMailAddress = lib.replaceChars [ "@" "\\" ] [ "%40" "%5C" ];
# home-manager has no way to set if an account requires AUTH LOGIN
# this emulats this by setting a list of known providers that do require it
requiresLogin = lib.elem
(lib.elemAt (lib.strings.splitString "@" address) 1)
[ "mailbox.tu-dresden.de" ];
in
{
source =
@ -31,7 +36,7 @@ in
outgoing =
if notmuch.enable
then "${./msmtp-wrapper} ${name}"
else "`smtp+plain://${quoteMailAddress userName}@${smtp.host}`";
else "`smtp${lib.optionalString requiresLogin "+login"}://${quoteMailAddress userName}@${smtp.host}`";
outgoing-cred-cmd = "`${lib.concatStringsSep " " passwordCommand}`";
from = "${realName} <${address}>";
smtp-starttls = if smtp.tls.useStartTls then "yes" else "no";