{ config, lib, pkgs, hostName, ... }: { home.packages = with pkgs; [ protonmail-bridge davmail ]; programs = { mbsync = { enable = true; groups.inboxes = { proton = [ "INBOX" ]; icloud = [ "INBOX" ]; }; }; msmtp.enable = true; mu.enable = true; }; 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 = lib.mkDefault 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" ]; passwordCommand = "${pkgs.pass}/bin/pass show Mail/Proton/${hostName}"; userName = address; imapnotify = { enable = true; boxes = [ "INBOX" ]; onNotify = "${pkgs.isync}/bin/mbsync --pull proton:INBOX"; onNotifyPost = "${pkgs.libnotify}/bin/notify-send 'Proton: New mail arrived'"; extraConfig = { tls = false; tlsOptions.rejectUnauthorized = false; }; }; mbsync = { enable = true; create = "both"; expunge = "both"; remove = "both"; patterns = [ "*" "!All Mail" "!Spam" "!Labels*" "!Starred" ]; subFolders = "Verbatim"; extraConfig.account.AuthMechs = "LOGIN"; }; msmtp = { enable = true; extraConfig = { tls = "off"; auth = "login"; }; }; mu.enable = true; }; icloud = rec { inherit realName; primary = lib.mkDefault false; maildir.path = "iCloud"; imap.host = "imap.mail.me.com"; smtp.host = "smtp.mail.me.com"; address = "e.litherlandsmith@icloud.com"; passwordCommand = "${pkgs.pass}/bin/pass show Mail/iCloud/mbsync"; userName = address; imapnotify = { enable = true; boxes = [ "INBOX" ]; onNotify = "${pkgs.isync}/bin/mbsync --pull icloud:INBOX"; onNotifyPost = "${pkgs.libnotify}/bin/notify-send 'Proton: New mail arrived'"; }; mbsync = { enable = true; create = "both"; expunge = "both"; remove = "both"; patterns = [ "*" "!Junk" ]; subFolders = "Verbatim"; }; msmtp.enable = true; mu.enable = true; }; ukaea = let host = "127.0.0.1"; tls.enable = false; in rec { inherit realName; primary = lib.mkDefault false; maildir.path = "UKAEA"; imap = { inherit host tls; port = 1144; }; smtp = { inherit host tls; port = 1026; }; address = "evie.litherland-smith@ukaea.uk"; aliases = [ "elitherl@jet.uk" ]; passwordCommand = "${pkgs.pass}/bin/pass show Mail/Outlook/ukaea"; userName = address; imapnotify = { enable = true; boxes = [ "INBOX" ]; onNotify = "${pkgs.isync}/bin/mbsync --pull ukaea:INBOX"; onNotifyPost = "${pkgs.libnotify}/bin/notify-send 'Proton: New mail arrived'"; extraConfig = { tls = false; tlsOptions.rejectUnauthorized = false; }; }; mbsync = { enable = true; create = "both"; expunge = "both"; remove = "both"; patterns = [ "*" "!Junk" "!Snoozed" "!Sync Issues" "!Unsent Messages" ]; subFolders = "Verbatim"; extraConfig.account.AuthMechs = "LOGIN"; }; msmtp = { enable = true; extraConfig = { tls = "off"; auth = "login"; }; }; mu.enable = true; }; }; }; }