From 5afcea8f057c26eb0f2411eb455e20ad8085059d Mon Sep 17 00:00:00 2001 From: Alex Palaistras Date: Sun, 20 Aug 2023 11:16:35 +0100 Subject: [PATCH] dovecot: Auto-archive unflagged messages in inbox --- .../dovecot/container/config/dovecot.conf.template | 10 ++++++++++ service/dovecot/spec.bu | 2 ++ service/dovecot/systemd/dovecot-autoarchive.service | 12 ++++++++++++ service/dovecot/systemd/dovecot-autoarchive.timer | 9 +++++++++ 4 files changed, 33 insertions(+) create mode 100644 service/dovecot/systemd/dovecot-autoarchive.service create mode 100644 service/dovecot/systemd/dovecot-autoarchive.timer diff --git a/service/dovecot/container/config/dovecot.conf.template b/service/dovecot/container/config/dovecot.conf.template index ac2dbcb..62b8665 100644 --- a/service/dovecot/container/config/dovecot.conf.template +++ b/service/dovecot/container/config/dovecot.conf.template @@ -53,6 +53,16 @@ namespace inbox { special_use = \Sent } + mailbox Archive { + auto = create + special_use = \Archive + } + + mailbox Archives { + auto = no + special_use = \Archive + } + mailbox Trash { auto = subscribe special_use = \Trash diff --git a/service/dovecot/spec.bu b/service/dovecot/spec.bu index 0f787d3..8e1ac74 100644 --- a/service/dovecot/spec.bu +++ b/service/dovecot/spec.bu @@ -14,3 +14,5 @@ systemd: enabled: true - name: dovecot-fts-optimize.timer enabled: true + - name: dovecot-autoarchive.timer + enabled: true diff --git a/service/dovecot/systemd/dovecot-autoarchive.service b/service/dovecot/systemd/dovecot-autoarchive.service new file mode 100644 index 0000000..435932d --- /dev/null +++ b/service/dovecot/systemd/dovecot-autoarchive.service @@ -0,0 +1,12 @@ +[Unit] +Description=Auto-archive Dovecot inbox messages +Wants=dovecot.service +After=dovecot.service + +[Service] +Type=oneshot +SyslogIdentifier=%N +ExecStart=/bin/podman exec dovecot doveadm -v move -A INBOX.Archive mailbox INBOX UNFLAGGED BEFORE 2w + +[Install] +WantedBy=multi-user.target diff --git a/service/dovecot/systemd/dovecot-autoarchive.timer b/service/dovecot/systemd/dovecot-autoarchive.timer new file mode 100644 index 0000000..c8bf08f --- /dev/null +++ b/service/dovecot/systemd/dovecot-autoarchive.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Auto-archive Dovecot inbox messages + +[Timer] +OnCalendar=daily +Persistent=true + +[Install] +WantedBy=timers.target