3 require [ "regex", "variables", "fileinto", "envelope", "mailbox", "imap4flags" ];
6 if anyof (header :contains "from" "unwanted at example.com",
7 header :contains "from" "spammer at example.net",
8 header :contains "from" "troll at example.org"){
13 if anyof (header :contains "x-spam-flag" "yes",
14 allof (header :regex "X-DSPAM-Result" "^(Spam|Virus|Bl[ao]cklisted)$",
15 not header :contains "X-DSPAM-Reclassified" "Innocent")){
16 # Spam goes into the spam folder
18 fileinto :create "spam";
22 # split out the various list forms
23 # Mailman & other lists using list-id
25 if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
26 set :lower "listname" "${1}";
27 fileinto :create "${listname}";
28 } elsif header :regex "list-id" "^\\s*<?([a-z_0-9-]+)[.@]" {
29 set :lower "listname" "${1}";
30 fileinto :create "${listname}";
35 # Listar and mailman like
36 elsif exists "x-list-id" {
37 if header :regex "x-list-id" "<([a-z_0-9-]+)\\\\." {
38 set :lower "listname" "${1}";
39 fileinto :create "${listname}";
45 elsif exists "mailing-list" {
46 if header :regex "mailing-list" "([a-z_0-9-]+)@" {
47 set :lower "listname" "${1}";
48 fileinto :create "${listname}";
54 elsif exists "x-mailing-list" {
55 if header :regex "x-mailing-list" "^\\s*([a-z_0-9-]+)@?" {
56 set :lower "listname" "${1}";
57 fileinto :create "${listname}";
63 elsif exists "x-loop" {
64 if header :regex "x-loop" "^\\s*(a-z_0-9-]+)@?" {
65 set :lower "listname" "${1}";
66 fileinto :create "${listname}";
72 elsif envelope :contains "from" "owner-" {
73 if envelope :regex "from" "owner-([a-z_0-9-]+)-outgoing@" {
74 set :lower "listname" "${1}";
75 fileinto :create "${listname}";
76 } elsif envelope :regex "from" "owner-([a-z_0-9-]+)@" {
77 set :lower "listname" "${1}";
78 fileinto :create "${listname}";
79 } elsif header :regex "Sender" "owner-([a-z_0-9-]+)@" {
80 set :lower "listname" "${1}";
81 fileinto :create "${listname}";
86 # other poorly identified
87 elsif envelope :contains "from" "-request" {
88 if envelope :regex "from" "([a-z_0-9-]+)-request@" {
89 set :lower "listname" "${1}";
90 fileinto :create "${listname}";