/[imapfilter]/imapfilter/sample.imapfilterrc
ViewVC logotype

Contents of /imapfilter/sample.imapfilterrc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (show annotations)
Sun Feb 8 22:16:02 2004 UTC (16 years, 9 months ago) by lefcha
Branch: MAIN
CVS Tags: HEAD
Changes since 1.17: +69 -24 lines
Another explanation of the and/or flags of the filter/mask commands.

1 ###########
2 # Options #
3 ###########
4 #
5 # Some program options, such as log file and non-response server timeout.
6 #
7 logfile = /home/user/.imapfilter.log
8 set timeout = 120
9 expunge = no
10 subscribe = yes
11
12
13 ##########################
14 # Accounts and mailboxes #
15 ##########################
16 #
17 # Each account has a number of folders/mailboxes which are grouped under an
18 # alias name. Folders belong to the last preceding account. A mailbox can
19 # belong to many mailbox groups.
20 #
21
22 #
23 # Connects to "imap1.mail.server" at port 143, as "user1" and using password
24 # "secret1".
25 #
26 # Mailboxes that exist at "imap1.mail.server" include: "INBOX", "bsd-maillist",
27 # "linux-maillist", etc. and are grouped in various ways.
28 #
29 account account1 user1:secret1@imap1.mail.server:143
30 folder inbox1 INBOX
31 folder bsd bsd-maillist
32 folder linux linux-maillist
33 folder lists linux-maillist,bsd-maillist
34 folder all INBOX,linux-maillist,bsd-maillist
35
36 #
37 # Another account and it's folder settings.
38 #
39 # It connects to an IMAP mail server using the SSLv3 protocol.
40 #
41 account account2 user2:secret2@imap2.mail.server ssl3
42 folder inbox2 INBOX
43 folder example "hello, world"
44
45 #
46 # A third account which password is intentionally ommited, either because it
47 # will be supplied interactively or because it will be stored securely using
48 # the integrated password editor.
49 #
50 account account3 user3@imap3.mail.server
51 folder inbox3 INBOX
52
53
54 ###########
55 # Filters #
56 ###########
57 #
58 # Filters are completely independent from any account or folder settings. The
59 # mask command may be ommited. If no masks are declared inside a filter entry,
60 # then all messages are matched.
61 #
62
63 #
64 # A possible anti-spam filter to get rid of unwanted messages.
65 #
66 # The "or" flag in the arguments of the filter command makes the filter masks
67 # work like this (in pseudocode):
68 #
69 # if (from ...)
70 # or if (from ...)
71 # or if (subject ...)
72 # then delete
73 #
74 filter spam or
75 mask from marketing@company.junk
76 mask from advertising@annoying.promotion
77 mask subject "new great products"
78 action delete
79
80 #
81 # And here is a filter that matches all messages except those that have an
82 # explicit "To" or "Cc" header or come from a friend's specific mail address.
83 #
84 # The "and" flag in the arguments of the filter command makes the filter masks
85 # work like this (in pseudocode):
86 #
87 # if (not to ...)
88 # and (not cc ...)
89 # and (not from ...)
90 # then delete
91 #
92 filter strict and
93 mask not to "name surname <email@address>"
94 mask not cc "name surname <email@address>"
95 mask not from friend@address
96 action delete
97
98 #
99 # Another filter useful for sorting of mail.
100 #
101 # This one moves messages with the specified "sender" header and an internal
102 # date newer than 14 days to the mailbox bsd-maillist.
103 #
104 # When no "or" or "and" flag is specified for a filter the default "and" is
105 # used.
106 #
107 filter bsdlist
108 header sender bsd-maillist@maillist.server
109 newer 14
110 action move bsd-maillist
111
112 #
113 # Messages can be copied to a folder, eg. for archive purposes.
114 #
115 # This filter copies all messages with the "[patch]" word in the subject header
116 # and smaller that 50000 bytes, to a mailbox named "patches" that may or may
117 # not exist (in the latter case it will be automatically created). Also,
118 # displays their "From" and "Subject" headers.
119 #
120 filter patch
121 subject "[patch]"
122 smaller 50000
123 action copy patches from,subject
124
125 #
126 # One can also just display some of the headers of messages that match a
127 # filter.
128 #
129 # This filter displays and/or writes to logfile the "From", "Subject" and
130 # "Date" headers of recent, unread messages, that come from "tux@penguin.land"
131 # or "beastie@daemon.land" but not with a subject containing the phrase "all
132 # work and no play".
133 #
134 # Note that the "recent and unseen" functionality can also be accomplished with
135 # "new" or even "not old".
136 #
137 filter display
138 recent
139 unseen
140 from tux@penguin.land
141 or from beastie@daemon.land
142 not subject "all work and no play"
143 action list from,subject,date
144
145 #
146 # Messages can be copied between two different accounts, ie. two different IMAP
147 # mail servers. It must be noted though, that this requires that the messages
148 # are downloaded from the source mail server and then uploaded to the target
149 # mail server.
150 #
151 # This filter copies matching messages to INBOX of "account3".
152 #
153 filter security or
154 from security@security.announcements
155 from security-announce@my.unix.os
156 action rcopy account3 INBOX subject,date
157
158 #
159 # Likewise, messages can be moved between different accounts.
160 #
161 filter weekly-news
162 from "weekly-news@news.letter"
163 action rmove account3 news
164
165 #
166 # One can set flags of messages. This can be accomplished with the "flag"
167 # keyword. It is possible to add, remove or replace the flags of a message.
168 #
169 # The filter below, adds the "flagged" flag (which is used to mark a message
170 # important) to matching mail.
171 #
172 filter new-release
173 from announce@my.bsd.os
174 or from announce@my.linux.os
175 subject "new release"
176 or body "new release"
177 action flag add flagged
178
179 #
180 # In some cases, such as when archiving messages, it is useful to make use of
181 # date conversion specifiers and/or the default variable, in the name of the
182 # destination mailbox of a filter.
183 #
184 # Date conversion specifiers are introduced with the at sign '@', for the date
185 # of the message, and the percent sign '%', for the system's current date.
186 #
187 # The default variable "$_" is replaced with the name of the mailbox that the
188 # filter is currently applied to.
189 #
190 # For example, this filter does a month based archiving of messages that are
191 # older than 60 days. When applied to the bsd-maillist and linux-maillist
192 # mailboxes, messages would be moved to mailboxes named bsd-maillist-2003-07,
193 # bsd-maillist-2003-08, etc. and linux-maillist-2003-07,
194 # linux-maillist-2003-08, etc., respectively.
195 #
196 filter archive
197 older 60
198 action move $_-@Y-@m
199
200 #
201 # And to clarify the combination of and/or flags in filter/mask commands here
202 # is something that might help:
203 #
204 # if A and (B or C) and (D or E or F) and G then ...
205 #
206 # Can be accomplished with:
207 #
208 # filter ... and
209 # A
210 # B
211 # or C
212 # D
213 # or E
214 # or F
215 # G
216 # action ...
217 #
218 # On the other hand:
219 #
220 # if A or (B and C) or (D and E and F) or G then ...
221 #
222 # Can be accomplished with:
223 #
224 # filter ... or
225 # A
226 # B
227 # and C
228 # D
229 # and E
230 # and F
231 # G
232 # action ...
233 #
234
235
236 ########
237 # Jobs #
238 ########
239 #
240 # Last, there is the definition of the jobs where user combines folders and
241 # filters _already_ defined, and specifies which filters should be applied to
242 # which folders.
243 #
244 job spam,display inbox1,inbox2
245 job patch,archive lists
246 job new-release,bsdlist inbox1

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26