diff --git a/modules/mail/default.nix b/modules/mail/default.nix index 4f77a8d..71b195f 100644 --- a/modules/mail/default.nix +++ b/modules/mail/default.nix @@ -8,7 +8,6 @@ in msmtp neomutt notmuch - pass w3m links2 ]; @@ -81,6 +80,7 @@ in systemd.user = { + # Service and timer to sync imap to local maildir services.mbsync = { enable = true; after = [ "graphical.target" "network-online.target" ]; @@ -102,5 +102,27 @@ in }; }; + # service and timer to flush the msmtp queue + services.flush-msmtpq = { + enable = true; + after = [ "graphical.target" "network-online.target" ]; + script = '' + ${pkgs.msmtp}/bin/msmtp-queue -r + ''; + serviceConfig = { + Type = "oneshot"; + }; + }; + + timers.flush-msmtpq = { + enable = true; + wantedBy = [ "timers.target" ]; + timerConfig = { + Unit = "flush-msmtpq.service"; + OnBootSec = "11m"; + OnUnitInactiveSec = "13m"; + }; + }; + }; }