email: Implement spam sorting with sieve

- Sieve script detects spam headers used by Rspamd and SpamAssassin
- Autosubscribe to Archive, Drafts, Junk, Sent, Trash
- Autoexpunge Trash and Junk folders
- INBOX.Junk -> Junk, INBOX.Trash -> Trash, Sent Messages -> Sent
This commit is contained in:
fliu authored and Sunil Mohan Adapa committed 2021-08-17 19:43:42 -07:00
1 parent 41f0461ac7
commit c31a896e81
5 files changed
+83

No files matched your search

@@ -0,0 +1,6 @@
# Direct edits to this file will be lost!
# Manage your settings on Plinth <https://localhost/plinth/apps/email_server>
protocol lmtp {
mail_plugins = $mail_plugins sieve
}
@@ -0,0 +1,43 @@
# Direct edits to this file will be lost!
# Manage your settings on Plinth <https://localhost/plinth/apps/email_server>
namespace inbox {
mailbox Archive {
auto = subscribe
special_use = \Archive
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
autoexpunge = 30d
special_use = \Junk
}
mailbox Trash {
auto = subscribe
autoexpunge = 30d
special_use = \Trash
}
mailbox INBOX.Junk {
auto = no
autoexpunge = 30d
special_use = \Junk
}
mailbox INBOX.Trash {
auto = no
autoexpunge = 30d
special_use = \Trash
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox "Sent Messages" {
auto = no
special_use = \Sent
}
}
@@ -0,0 +1,6 @@
# Direct edits to this file will be lost!
# Manage your settings on Plinth <https://localhost/plinth/apps/email_server>
plugin {
sieve_after = /etc/dovecot/freedombox-sieve-after
}
@@ -0,0 +1,8 @@
require ["fileinto", "mailbox"];
if anyof(header :contains "X-Spam" "Yes",
header :contains "X-Spam-Status" "Yes",
header :matches "X-Spam-Flag" "YES") {
fileinto :create "Junk";
stop;
}