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

Annotation of /imapfilter/sample.imapfilterrc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (hide annotations)
Sun Feb 8 22:16:02 2004 UTC (20 years, 1 month 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 lefcha 1.9 ###########
2     # Options #
3     ###########
4     #
5 lefcha 1.12 # Some program options, such as log file and non-response server timeout.
6 lefcha 1.9 #
7 lefcha 1.14 logfile = /home/user/.imapfilter.log
8 lefcha 1.12 set timeout = 120
9 lefcha 1.14 expunge = no
10     subscribe = yes
11 lefcha 1.9
12    
13 lefcha 1.7 ##########################
14     # Accounts and mailboxes #
15     ##########################
16 lefcha 1.8 #
17 lefcha 1.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 lefcha 1.8 #
21 lefcha 1.7
22     #
23 lefcha 1.17 # Connects to "imap1.mail.server" at port 143, as "user1" and using password
24     # "secret1".
25 lefcha 1.7 #
26 lefcha 1.17 # Mailboxes that exist at "imap1.mail.server" include: "INBOX", "bsd-maillist",
27     # "linux-maillist", etc. and are grouped in various ways.
28 lefcha 1.8 #
29 lefcha 1.14 account account1 user1:secret1@imap1.mail.server:143
30 lefcha 1.8 folder inbox1 INBOX
31 lefcha 1.14 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 lefcha 1.7
36     #
37     # Another account and it's folder settings.
38     #
39 lefcha 1.11 # It connects to an IMAP mail server using the SSLv3 protocol.
40     #
41 lefcha 1.14 account account2 user2:secret2@imap2.mail.server ssl3
42 lefcha 1.8 folder inbox2 INBOX
43 lefcha 1.17 folder example "hello, world"
44    
45 lefcha 1.14 #
46 lefcha 1.17 # 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 lefcha 1.14 #
50     account account3 user3@imap3.mail.server
51     folder inbox3 INBOX
52 lefcha 1.7
53    
54     ###########
55     # Filters #
56     ###########
57     #
58 lefcha 1.17 # 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 lefcha 1.7 #
62    
63     #
64     # A possible anti-spam filter to get rid of unwanted messages.
65     #
66 lefcha 1.17 # The "or" flag in the arguments of the filter command makes the filter masks
67     # work like this (in pseudocode):
68 lefcha 1.18 #
69 lefcha 1.17 # if (from ...)
70     # or if (from ...)
71     # or if (subject ...)
72 lefcha 1.7 # then delete
73     #
74     filter spam or
75 lefcha 1.8 mask from marketing@company.junk
76     mask from advertising@annoying.promotion
77 lefcha 1.9 mask subject "new great products"
78 lefcha 1.7 action delete
79    
80     #
81 lefcha 1.17 # And here is a filter that matches all messages except those that have an
82 lefcha 1.18 # 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 lefcha 1.14 #
87 lefcha 1.18 # 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 lefcha 1.14 action delete
97    
98     #
99 lefcha 1.7 # Another filter useful for sorting of mail.
100     #
101 lefcha 1.17 # This one moves messages with the specified "sender" header and an internal
102     # date newer than 14 days to the mailbox bsd-maillist.
103 lefcha 1.7 #
104 lefcha 1.17 # When no "or" or "and" flag is specified for a filter the default "and" is
105     # used.
106 lefcha 1.7 #
107 lefcha 1.11 filter bsdlist
108 lefcha 1.14 header sender bsd-maillist@maillist.server
109 lefcha 1.11 newer 14
110 lefcha 1.14 action move bsd-maillist
111 lefcha 1.7
112     #
113     # Messages can be copied to a folder, eg. for archive purposes.
114     #
115 lefcha 1.18 # 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 lefcha 1.7 #
120 lefcha 1.18 filter patch
121 lefcha 1.14 subject "[patch]"
122 lefcha 1.8 smaller 50000
123 lefcha 1.9 action copy patches from,subject
124 lefcha 1.7
125     #
126 lefcha 1.18 # One can also just display some of the headers of messages that match a
127     # filter.
128 lefcha 1.7 #
129 lefcha 1.18 # 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 lefcha 1.7 #
134 lefcha 1.18 # Note that the "recent and unseen" functionality can also be accomplished with
135     # "new" or even "not old".
136 lefcha 1.7 #
137     filter display
138 lefcha 1.8 recent
139     unseen
140     from tux@penguin.land
141     or from beastie@daemon.land
142 lefcha 1.9 not subject "all work and no play"
143 lefcha 1.7 action list from,subject,date
144 lefcha 1.10
145 lefcha 1.14 #
146 lefcha 1.18 # 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 lefcha 1.14 #
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 lefcha 1.10
165     #
166 lefcha 1.14 # 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 lefcha 1.10 #
172 lefcha 1.14 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 lefcha 1.7
179 lefcha 1.17 #
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 lefcha 1.18 #
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 lefcha 1.7
236     ########
237     # Jobs #
238     ########
239     #
240 lefcha 1.18 # 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 lefcha 1.7 #
244     job spam,display inbox1,inbox2
245 lefcha 1.17 job patch,archive lists
246 lefcha 1.15 job new-release,bsdlist inbox1

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26