File: sieve

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (42 lines) | stat: -rw-r--r-- 1,109 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Hacked from https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)

# Sieve filter

# Declare the extensions used by this script.
#
require ["fileinto", "reject", "imapsieve", "environment", "variables"];

# simple variable interpolation highlight test
if environment :matches "imap.user" "*" {
      set "username" "${1}";
}

# Messages bigger than 9K will be rejected with an error message
#
if size :over 9K {
   reject "IT'S OVER NIIIINNE
THOUSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAND!!!@$#!";
}

# Mails from a mailing list will be put into the folder "mailinglist"
#
elsif address :is ["From", "To"] "mailinglist@blafasel.invalid" {
   fileinto "INBOX.mailinglist";
}

# Spam Rule: Message does not contain my address in To, CC or Bcc
# header, or subject is something with "money" or "Viagra".
#
elsif anyof (not address :all :contains ["To", "Cc", "Bcc"] "me@blafasel.invalid",
header :matches "Subject" ["*money*","*Viagra*"]) {
      fileinto "INBOX.spam";
}

# Keep the rest.
# This is not necessary because there is a "implicit keep" Rule
#
else {
     keep;
}

# Comment at EOL