Skip to content

Instantly share code, notes, and snippets.

@eatnumber1
Created May 6, 2014 18:42
Show Gist options
  • Save eatnumber1/87cbdb07c753980be90f to your computer and use it in GitHub Desktop.
Save eatnumber1/87cbdb07c753980be90f to your computer and use it in GitHub Desktop.
Mail filters:
Process this with m4 to produce copy & pasteable output.
Keep in mind that multiple filters without an operator between them actually means logical and.
dnl
changequote(`[', `]')dnl
define([filter],
[patsubst(
translit([$1], [
], [ ]),
[ +], [ ])])dnl
Name:
Sent by humans, doesn't match Name Prod.
filter(
-from:foo@bar.com
-list:foo@bar.com
(
list:foo@bar.com OR
list:foo@bar.com OR
list:foo@bar.com OR
(list:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-from:foo@bar.com
-from:foo@bar.com
-list:foo@bar.com
dnl Aggrivatingly, these emails are to foo@bar and from foo@bar
dnl and have no additional information.
-subject:foo@bar.com)
OR
(list:foo@bar.com
-from:foo@bar.com
-from:foo@bar.com)
OR
(list:foo@bar.com
-to:foo@bar.com)
)
)
Name Prod:
Sent by humans, relevant to oncaller.
filter(
(list:foo@bar.com
-from:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com
-to:foo@bar.com)
OR
(list:foo@bar.com
-from:foo@bar.com
-from:foo@bar.com)
OR
list:foo@bar.com
)
Robots:
Automated mail. Should be conceptually equivalent to ~(Name ∪ Name Prod).
filter(
(list:foo@bar.com
(to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com OR
from:foo@bar.com OR
dnl Aggrivatingly, these emails are to foo@bar.com and from foo@bar.com
dnl and have no additional information.
subject:foo@bar.com))
OR
(list:foo@bar.com
(to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com OR
to:foo@bar.com))
OR
(list:foo@bar.com
from:foo@bar.com)
OR
(list:foo@bar.com
to:foo@bar.com)
OR
list:foo@bar.com OR
from:foo@bar.com
)
Bugs:
Description goes here
filter(
from:foo@bar.com
(list:foo@bar.com OR
list:foo@bar.com OR
list:foo@bar.com)
)
Reviews:
Code reviews
filter(
(list:foo@bar.com
list:foo@bar.com)
OR
list:foo@bar.com
)
dnl vim:ft=m4 tw=100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment