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 |
# if (from ...) |
69 |
# or if (from ...) |
70 |
# or if (subject ...) |
71 |
# then delete |
72 |
# |
73 |
filter spam or |
74 |
mask from marketing@company.junk |
75 |
mask from advertising@annoying.promotion |
76 |
mask subject "new great products" |
77 |
action delete |
78 |
|
79 |
# |
80 |
# And here is a filter that matches all messages except those that have an |
81 |
# explicit "To" header, a really strict filter. |
82 |
# |
83 |
filter strict |
84 |
not to "name surname <email@address>" |
85 |
action delete |
86 |
|
87 |
# |
88 |
# Another filter useful for sorting of mail. |
89 |
# |
90 |
# This one moves messages with the specified "sender" header and an internal |
91 |
# date newer than 14 days to the mailbox bsd-maillist. |
92 |
# |
93 |
# When no "or" or "and" flag is specified for a filter the default "and" is |
94 |
# used. |
95 |
# |
96 |
filter bsdlist |
97 |
header sender bsd-maillist@maillist.server |
98 |
newer 14 |
99 |
action move bsd-maillist |
100 |
|
101 |
# |
102 |
# Messages can be copied to a folder, eg. for archive purposes. |
103 |
# |
104 |
# This filter copies all messages with the "[patch]" word in |
105 |
# the subject header and smaller that 50000 bytes, to a mailbox |
106 |
# named "patches" that may or may not exist (in the latter case |
107 |
# it will be automatically created). Also, displays their "From" and |
108 |
# "Subject" headers. |
109 |
# |
110 |
filter patch and |
111 |
subject "[patch]" |
112 |
smaller 50000 |
113 |
action copy patches from,subject |
114 |
|
115 |
# |
116 |
# One can also just display some of the headers of messages that match |
117 |
# a filter. |
118 |
# |
119 |
# This filter displays and/or writes to logfile the "From", "Subject" |
120 |
# and "Date" headers of recent, unread messages, that come from |
121 |
# "tux@penguin.land" or "beastie@daemon.land" but not with a subject |
122 |
# containing the phrase "all work and no play". |
123 |
# |
124 |
# Note that the "recent and unseen" functionality can also be |
125 |
# accomplished with "new" or even "not old". |
126 |
# |
127 |
filter display |
128 |
recent |
129 |
unseen |
130 |
from tux@penguin.land |
131 |
or from beastie@daemon.land |
132 |
not subject "all work and no play" |
133 |
action list from,subject,date |
134 |
|
135 |
# |
136 |
# Messages can be copied between two different accounts, ie. two |
137 |
# different IMAP mail servers. It must be noted though, that this |
138 |
# requires that the messages are downloaded from the source mail |
139 |
# server and then uploaded to the target mail server. |
140 |
# |
141 |
# This filter copies matching messages to INBOX of "account3". |
142 |
# |
143 |
filter security or |
144 |
from security@security.announcements |
145 |
from security-announce@my.unix.os |
146 |
action rcopy account3 INBOX subject,date |
147 |
|
148 |
# |
149 |
# Likewise, messages can be moved between different accounts. |
150 |
# |
151 |
filter weekly-news |
152 |
from "weekly-news@news.letter" |
153 |
action rmove account3 news |
154 |
|
155 |
# |
156 |
# One can set flags of messages. This can be accomplished with the "flag" |
157 |
# keyword. It is possible to add, remove or replace the flags of a message. |
158 |
# |
159 |
# The filter below, adds the "flagged" flag (which is used to mark a message |
160 |
# important) to matching mail. |
161 |
# |
162 |
filter new-release |
163 |
from announce@my.bsd.os |
164 |
or from announce@my.linux.os |
165 |
subject "new release" |
166 |
or body "new release" |
167 |
action flag add flagged |
168 |
|
169 |
# |
170 |
# In some cases, such as when archiving messages, it is useful to make use of |
171 |
# date conversion specifiers and/or the default variable, in the name of the |
172 |
# destination mailbox of a filter. |
173 |
# |
174 |
# Date conversion specifiers are introduced with the at sign '@', for the date |
175 |
# of the message, and the percent sign '%', for the system's current date. |
176 |
# |
177 |
# The default variable "$_" is replaced with the name of the mailbox that the |
178 |
# filter is currently applied to. |
179 |
# |
180 |
# For example, this filter does a month based archiving of messages that are |
181 |
# older than 60 days. When applied to the bsd-maillist and linux-maillist |
182 |
# mailboxes, messages would be moved to mailboxes named bsd-maillist-2003-07, |
183 |
# bsd-maillist-2003-08, etc. and linux-maillist-2003-07, |
184 |
# linux-maillist-2003-08, etc., respectively. |
185 |
# |
186 |
filter archive |
187 |
older 60 |
188 |
action move $_-@Y-@m |
189 |
|
190 |
|
191 |
######## |
192 |
# Jobs # |
193 |
######## |
194 |
# |
195 |
# Last, there is the definition of the jobs where user combines |
196 |
# folders and filters _already_ defined, and specifies which filters |
197 |
# should be applied to which folders. |
198 |
# |
199 |
job spam,display inbox1,inbox2 |
200 |
job patch,archive lists |
201 |
job new-release,bsdlist inbox1 |