Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rfc3028 - sievescripts.txt « docs - github.com/thsmi/sieve.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e8af32995ff94f60c9221b18ac808d39714254d7 (plain)
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
This Sievecode is extracted from the sieve spec.

_Comments_______________________________________________________________________

if size :over 100K { # this is a comment
  discard;
}

---

if size :over 100K { /* this is a comment
  this is still a comment */ discard /* this is a comment
  */ ;
}

_Test Lists_____________________________________________________________________

if anyof (not exists ["From", "Date"],
      header :contains "from" "fool@example.edu") {
   discard;
}

_Comparators____________________________________________________________________

if header :contains :comparator "i;octet" "Subject"
   "MAKE MONEY FAST" {
      discard;
}

_Implicit Keep__________________________________________________________________

if size :over 500K { discard; }

_Control Structure If´__________________________________________________________

require "fileinto";
if header :contains "from" "coyote" {
   discard;
} elsif header :contains ["subject"] ["$$$"] {
   discard;
} else {
   fileinto "INBOX";
}

---

if header :contains ["From"] ["coyote"] {
   redirect "acm@example.edu";
} elsif header :contains "Subject" "$$$" {
   redirect "postmaster@example.edu";
} else {
   redirect "field@example.edu";
}

_Control Structure Require______________________________________________________

require ["fileinto", "reject"];

---

require "fileinto";
require "vacation";

_Action reject__________________________________________________________________

if header :contains "from" "coyote@desert.example.org" {
   reject "I am not taking mail from you, and I don't want
   your birdseed, either!";
}

_Action fileinto________________________________________________________________

require "fileinto";
if header :contains ["from"] "coyote" {
   fileinto "INBOX.harassment";
}

_Action redirect________________________________________________________________

redirect "bart@example.edu";

_Action keep____________________________________________________________________

if size :under 1M { keep; } else { discard; }

--

if not size :under 1M { discard; }

_Action discard_________________________________________________________________

if header :contains ["from"] ["idiot@example.edu"] {
   discard;
}

_Test Address___________________________________________________________________

if address :is :all "from" "tim@example.com" {
   discard;
}

_Envelope Test__________________________________________________________________

require "envelope";
if envelope :all :is "from" "tim@example.com" {
   discard;
}

_Test exists____________________________________________________________________

if not exists ["From","Date"] {
                discard;
             }

_Extended Example_______________________________________________________________

#
# Example Sieve Filter
# Declare any optional features or extension used by the script
#
require ["fileinto", "reject"];

#
# Reject any large messages (note that the four leading dots get
# "stuffed" to three)
#
if size :over 1M
        {
        reject text:
Please do not send me large attachments.
Put your file on a server and send me the URL.
Thank you.
.... Fred
.
;
        stop;
        }
#
# Handle messages from known mailing lists
# Move messages from IETF filter discussion list to filter folder
#
if header :is "Sender" "owner-ietf-mta-filters@imc.org"
        {
        fileinto "filter";  # move to "filter" folder
        }
#
# Keep all messages to or from people in my company
#
elsif address :domain :is ["From", "To"] "example.com"
        {
        keep;               # keep in "In" folder
        }

#
# Try and catch unsolicited email.  If a message is not to me,
# or it contains a subject known to be spam, file it away.
#
elsif anyof (not address :all :contains
               ["To", "Cc", "Bcc"] "me@example.com",
             header :matches "subject"
               ["*make*money*fast*", "*university*dipl*mas*"])
        {
        # If message header does not contain my address,
        # it's from a list.
        fileinto "spam";   # move to "spam" folder
        }
else
        {
        # Move all other (non-company) mail to "personal"
        # folder.
        fileinto "personal";
        }
        
__________________________________________________        
if anyof address :domain :is ["From", "To"] "company.com"
           {
           keep;               # keep in "In" folder
           }