{ pkgs, hostname, ... }: { home.packages = with pkgs; [protonmail-bridge-gui]; accounts.email = { maildirBasePath = "Mail"; accounts = let realName = "Evie Litherland-Smith"; in { proton = let host = "127.0.0.1"; tls.enable = false; in rec { inherit realName; primary = true; maildir.path = "Proton"; imap = { inherit host tls; port = 1143; }; smtp = { inherit host tls; port = 1025; }; address = "e.litherlandsmith@proton.me"; aliases = ["evie@xenia.me.uk" "evie@litherlandsmith.slmail.me"]; userName = address; passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostname}/proton | head -n1"; mu.enable = true; msmtp = { enable = true; extraConfig = { tls = "off"; auth = "login"; }; }; mbsync = { enable = true; create = "both"; expunge = "both"; remove = "both"; patterns = ["*" "!All Mail" "!Labels*" "!Starred" "!Recovered Messages"]; subFolders = "Verbatim"; extraConfig.account.AuthMechs = "LOGIN"; }; }; icloud = rec { inherit realName; primary = false; maildir.path = "iCloud"; imap.host = "imap.mail.me.com"; smtp.host = "smtp.mail.me.com"; address = "e.litherlandsmith@icloud.com"; userName = address; passwordCommand = "${pkgs.pass}/bin/pass show mbsync/${hostname}/icloud | head -n1"; mu.enable = true; msmtp.enable = true; mbsync = { enable = true; create = "both"; expunge = "both"; remove = "both"; patterns = ["*" "!Notes"]; subFolders = "Verbatim"; }; }; }; }; programs = { mu.enable = true; msmtp.enable = true; mbsync = { enable = true; groups.inboxes = { proton = ["INBOX"]; icloud = ["INBOX"]; }; }; }; }