summaryrefslogtreecommitdiff
path: root/home/mail/dovecot.sieve
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2023-01-18 21:22:48 -0600
committerAlejandro Soto <alejandro@34project.org>2023-01-18 21:22:48 -0600
commit06ac78d36a437429524a93e02564746326859789 (patch)
tree81ccd62127bc76d950e66cb4657e0a43fd4d8c78 /home/mail/dovecot.sieve
parent2f617bd184ba778d21ca910776416024fc32bc7b (diff)
home/mail: add sieve script
Diffstat (limited to 'home/mail/dovecot.sieve')
-rw-r--r--home/mail/dovecot.sieve53
1 files changed, 53 insertions, 0 deletions
diff --git a/home/mail/dovecot.sieve b/home/mail/dovecot.sieve
new file mode 100644
index 0000000..861a118
--- /dev/null
+++ b/home/mail/dovecot.sieve
@@ -0,0 +1,53 @@
+# Comando (pkgs.dovecot_pigeonhole) para filtrar mensajes existentes:
+#
+# $ sieve-filter -v -C -u alejandro@34project.org ~/.dovecot.sieve INBOX
+#
+# Ese comando es un dry-run, agregar "-W -e" para proceder. Probablemente es
+# buena idea hacer 'snapshot -r' de ~/mail antes de ejecutar eso. El primer run
+# tomó como 15 minutos para procesar todo el maildir.
+#
+# https://blog.bastelfreak.de/2020/08/dovecot-apply-sieve-filter-to-existing-emails/
+
+require ["fileinto", "mailbox"];
+
+if anyof(
+ address :is "from" ["mailer-daemon@34project.org"],
+ address :is :localpart "to" ["abuse", "security", "postmaster", "hostmaster", "sysadmin"]
+) {
+ fileinto :create "admin";
+} elsif address :is "from" "notifications@github.com" {
+ fileinto :create "github";
+} elsif address :is "from" [
+ "lwn@lwn.net",
+ "info@fsf.org"
+ ]
+{
+ fileinto :create "news";
+} elsif anyof(
+ address :is "from" [
+ "factura@factura.tigo.cr",
+ "factura_electronica@claro.cr",
+ "bcrtarjestcta@bancobcr.com"
+ ],
+
+ allof(
+ address :is "from" "bncontacto@bncr.fi.cr",
+ header :is "Subject" "Voucher Digital"
+ ),
+
+ allof(
+ address :is "from" [
+ "support-renew@gandi.net",
+ "support-es@gandi.net",
+ "support-es@support.gandi.net"
+ ],
+
+ header :contains "Subject" ["Automatic crediting", "Factura", "domain name renewed"]
+ )
+) {
+ fileinto :create "bills";
+} elsif address :is :domain ["from", "to"] ["estudiantec.cr", "itcr.ac.cr", "tec.ac.cr"] {
+ fileinto :create "tec";
+} elsif address :is :domain "from" ["turing.com", "paypal.com"] {
+ fileinto :create "spam";
+}