~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to doc/wiki/LDA.Sieve.txt

  • Committer: Bazaar Package Importer
  • Author(s): CHuck Short, Chuck Short
  • Date: 2009-11-06 00:47:29 UTC
  • mfrom: (4.1.9 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091106004729-i39n7v9e7d4h51f6
Tags: 1:1.2.6-1ubuntu1
* Merge from debian testing, remaining changes:
  Add new binary pkg dovecot-postfix that integrates postfix and dovecot
  automatically: (LP: #164837)
  + debian/control:
    - add new binary with short description
    - set Architecture all for dovecot-postfix (LP: #329878)
  + debian/dovecot-postfix.postinst:
    - create initial certificate symlinks to snakeoil.
    - set up postfix with postconf to:
      - use Maildir/ as the default mailbox.
      - use dovecot as the sasl authentication server.
      - use dovecot LDA (deliver).
      - use tls for smtp{d} services.
    - fix certificates paths in postfix' main.cf
    - add reject_unauth_destination to postfix' recipient restrictions
    - add reject_unknown_sender_domain to postfix' sender restrictions
    - rename configuration name on remove, delete on purge
    - restart dovecot after linking certificates
    - handle use case when postfix is unconfigurated
   + debian/dovecot-postfix.dirs: create backup directory for postfix's configuration
   + restart postfix and dovecot.
   + debian/dovecot-postfix.postrm:
     - remove all dovecot related configuration from postfix.
     - restart postfix and dovecot.
   + debian/dovecot-common.init:
     - check if /etc/dovecot/dovecot-postfix.conf exists and use it
       as the configuration file if so.
   + debian/patches/warning-ubuntu-postfix.dpatch
     - add warning about dovecot-postfix.conf in dovecot default 
       configuration file
   + debian/patches/dovecot-postfix.conf.diff:
     - Ubuntu server custom changes to the default dovecot configuration for
       better interfation with postfix
     - enable sieve plugin
   + debian/patches/dovecot-postfix.conf.diff:
     + Ubuntu server custom changes to the default dovecot configuration for
       better integration with postfix:
       - enable imap, pop3, imaps, pop3s and managesieve by default.
       - enable dovecot LDA (deliver).
       - enable SASL auth socket in postfix private directory.
   + debian/rules:
     - copy, patch and install dovecot-postfix.conf in /etc/dovecot/.
     - build architecure independent packages too
   + Use Snakeoil SSL certificates by default.
     - debian/control: Depend on ssl-cert.
     - debian/patches/ssl-cert-snakeoil.dpatch: Change default SSL cert
       paths to snakeoil.
     - debian/dovecot-common.postinst: Relax grep for SSL_* a bit.
   + Add autopkgtest to debian/tests/*.
   + Fast TearDown: Update the lsb init header to not stop in level 6.
   + Add ufw integration:
     - Created debian/dovecot-common.ufw.profile.
     - debian/rules:
       + install profile
     - debian/control:
       + Suggest ufw
   + debian/{control,rules}: enable PIE hardening.
   + dovecot-imapd, dovecot-pop3: Replaces dovecot-common (<< 1:1.1). LP: #254721
   + debian/control:
     - Update Vcs-* headers.
   + debian/rules:
     - Create emtpy stamp.h.in files in dovecot-sieve/ and dovecot-managesieve/
       if they're not there since empty files are not included in the diff.gz 
       file.
   + Add SMTP-AUTH support for Outlook (login auth mechanism)
   + Dropped:
     - debian/patches/security-CVE-2009-3235: Applied upstream.
     - debian/patches/fix-pop3-assertion.dpatch: Applied upstream.
     - dovecot-sieve and dovecot-managesieve: Use the debian patches instead.

  [Chuck Short]
  - Updated dovecot-sieve to 0.1.13.
  - Updated dovecot-managesieve to 0.11.9.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Dovecot Sieve plugin
2
2
====================
3
3
 
 
4
Contents
 
5
 
 
6
 
4
7
 1. Dovecot Sieve plugin
 
8
 
5
9
     1. Introduction
6
 
     2. Getting the sources
7
 
     3. Compiling
8
 
     4. Configuring
9
 
     5. Per-user Sieve script location
10
 
     6. Script compiling and errors
11
 
     7. How to stop using sieve
12
 
     8. Features
13
 
         1. CMUSieve Plug-in
14
 
         2. New Sieve Plug-in
15
 
     9. ManageSieve server
16
 
     10. Validate your script
17
 
     11. v1.0 namespaces and fileinto
18
 
     12. Vacation auto-reply
19
 
     13. Example scripts
20
 
          1. SpamAssassin tagged mail filtering
21
 
          2. Mail filtering by various headers
22
 
          3. Flagging or Highlighting your mail
23
 
          4. Vacation auto-reply
24
 
          5. Include scripts
25
 
     14. French Howto
26
 
     15. Migration from Procmail
 
10
 
 
11
     2. Installation and configuration
 
12
 
 
13
     3. Features
 
14
 
 
15
     4. ManageSieve server
 
16
 
 
17
     5. Validate your script
 
18
 
 
19
     6. Mailbox names with fileinto
 
20
 
 
21
     7. Vacation auto-reply
 
22
 
 
23
     8. Example scripts
 
24
 
 
25
         1. SpamAssassin tagged mail filtering
 
26
 
 
27
         2. Plus Addressed mail filtering
 
28
 
 
29
         3. Mail filtering by various headers
 
30
 
 
31
         4. Flagging or Highlighting your mail
 
32
 
 
33
         5. Vacation auto-reply
 
34
 
 
35
         6. Include scripts
 
36
 
 
37
     9. French Howto
 
38
 
 
39
     10. Migration from Procmail
27
40
 
28
41
Introduction
29
42
------------
30
43
 
31
 
The Dovecot Sieve plug-in provides mail filtering facilities at time of final
 
44
The Dovecot Sieve plugin provides mail filtering facilities at time of final
32
45
message delivery using the Sieve (RFC 5228
33
46
[http://www.ietf.org/rfc/rfc5228.txt]) language. By writing Sieve scripts,
34
47
users can customize how messages are delivered, e.g. whether they are forwarded
39
52
mail store. The intention of the language is to make it impossible for users to
40
53
do anything more complex (and dangerous) than write simple mail filters.
41
54
 
42
 
This wiki page explains how to use the Sieve language with Dovecot. It is
43
 
implemented as a plug-in to the deliver [http://wiki.dovecot.org/LDA] LDA.
44
 
Currently, two concurrent implementations of the Sieve plug-in are available.
45
 
The original plug-in called *CMUSieve* uses the Sieve interpreter from the
46
 
Cyrus project and has been available for Dovecot versions ranging from v1.0 to
47
 
the latest v1.2. Recently, a fully rewritten implementation was released for
48
 
Dovecot v1.2. This new plug-in is simply called *Sieve*. The main reason for
49
 
rewriting the Sieve engine is to provide more reliable script execution and to
50
 
provide better error messages to users and system administrators.
51
 
 
52
 
Getting the sources
53
 
-------------------
54
 
 
55
 
Both implementations of the Sieve plug-in are distributed in a separate
56
 
package:
57
 
 
58
 
 * You can get the CMUSieve plug-in from Dovecot's download page
59
 
   [http://www.dovecot.org/download.html].
60
 
 * You can get the new Sieve plug-in at this web page
61
 
   [http://www.rename-it.nl/dovecot/1.2/]. The tarballs for the Sieve releases
62
 
   are called dovecot-1.2-sieve-x.y.z.tar.gz in which the x.y.z represents the
63
 
   particular version.
64
 
 
65
 
Alternatively, you can obtain the latest versions from Mercurial repositories:
66
 
 
67
 
 * The CMUSieve plug-in has different repositories for the available Dovecot
68
 
   versions:
69
 
    * For v1.0: 'http://hg.dovecot.org/dovecot-sieve-1.0'
70
 
    * For v1.1 and v1.2: 'http://hg.dovecot.org/dovecot-sieve-1.1'
71
 
 * The repository of the new Sieve plugin is:
72
 
   'http://hg.rename-it.nl/dovecot-libsieve'
73
 
 
74
 
In Ubuntu, starting from version 7.10 Gutsy, the CMUSieve plug-in already comes
75
 
with Dovecot regular install. In this case you do not have to download
76
 
additional packages. Simply skip "Compiling" section and proceed to
77
 
"Configuring". This is also true for Debian Etch.
78
 
 
79
 
Compiling
80
 
---------
81
 
 
82
 
Compilation is identical among the CMUSieve and the new Sieve plug-in. Use
83
 
'--with-dovecot=<path>' to point to 'dovecot-config' file's directory. There
84
 
are two possibilities where this could exist:
85
 
 
86
 
 1. If you configured Dovecot with '--enable-header-install', you'll have
87
 
    'dovecot-config' installed in '$prefix/lib/dovecot/' directory.
88
 
 2. Compiled Dovecot sources' root directory.
89
 
 
90
 
So for example:
91
 
 
92
 
---%<-------------------------------------------------------------------------
93
 
./configure --with-dovecot=/usr/local/lib/dovecot
94
 
make
95
 
sudo make install
96
 
---%<-------------------------------------------------------------------------
97
 
 
98
 
If you downloaded the sources using Mercurial, you will need to execute
99
 
'./autogen.sh' first to build the automake structure in your source tree. This
100
 
process requires autotools and libtool to be installed.
101
 
 
102
 
Binaries for command line tools like 'sievec' and 'sieved' are built only if
103
 
you use method 2, because they need to link with Dovecot's libraries. These two
104
 
tools can be used to compile and decompile Sieve scripts. You probably do not
105
 
need these, except when using the Python<ManageSieve.txt> server (it uses
106
 
'sievec' to verify uploaded scripts). The new Sieve implementation has a few
107
 
additional tools that can be used to verify and debug scripts from the command
108
 
line (refer to the README file for more information).
109
 
 
110
 
Configuring
111
 
-----------
112
 
 
113
 
First, you'll need to make sure you're using Dovecot's <deliver> [LDA.txt] to
114
 
deliver incoming mail to users' mailboxes. Then you need to enable the Sieve
115
 
plugin in your 'dovecot.conf'. The CMUSieve plugin is called 'cmusieve' and the
116
 
new Sieve plugin is called 'sieve'. The CMUSieve plugin is for example enabled
117
 
as follows:
118
 
 
119
 
---%<-------------------------------------------------------------------------
120
 
protocol lda {
121
 
..
122
 
  # If there is no user-specific Sieve-script, global Sieve script is
123
 
  # executed if set. (v1.0.1 and older used "global_script_path")
124
 
  # (e.g. /etc/dovecot/default.sieve)
125
 
  #sieve_global_path =
126
 
  # Support for dynamically loadable plugins. mail_plugins is a space separated
127
 
  # list of plugins to load.
128
 
  mail_plugins = cmusieve # ... other plugins like quota
129
 
}
130
 
---%<-------------------------------------------------------------------------
131
 
 
132
 
In this context /sieve_global_path/ refers to a *filename*, and not a
133
 
directory.
134
 
 
135
 
Per-user Sieve script location
 
55
The bottom of this page provides a few specific Sieve script examples. See
 
56
Sieve wiki [http://sieve.info/] for more comprehensive information about the
 
57
Sieve language itself.
 
58
 
 
59
Installation and configuration
136
60
------------------------------
137
61
 
138
 
By default Dovecot looks for user's Sieve script from '.dovecot.sieve' file in
139
 
user's home directory. This requires that the<home directory>
140
 
[VirtualUsers.txt] is set for the user.
141
 
 
142
 
If you want to store the script elsewhere, you can override the default by
143
 
returning 'sieve' setting containing path to the file. This can be done in two
144
 
ways:
145
 
 
146
 
 1. Define 'sieve' setting in plugin section of 'dovecot.conf'.
147
 
 2. Return 'sieve' extra field from <userdb extra fields>
148
 
    [UserDatabase.ExtraFields.txt].
149
 
 
150
 
For example to create a Sieve script file named '<username>.sieve' in
151
 
'/var/sieve-scripts', use:
152
 
 
153
 
---%<-------------------------------------------------------------------------
154
 
plugin {
155
 
 # NOTE: %variable expansion works only with Dovecot v1.0.2+
156
 
 sieve = /var/sieve-scripts/%u.sieve
157
 
}
158
 
---%<-------------------------------------------------------------------------
159
 
 
160
 
You may use templates like %u in the example. See all <variables>
161
 
[Variables.txt].
162
 
 
163
 
A relative path (or just a filename) will be interpreted to point under the
164
 
user's home directory.
165
 
 
166
 
Script compiling and errors
167
 
---------------------------
168
 
 
169
 
When the Sieve script is executed for the first time (or after it has been
170
 
changed), it's compiled into into a binary form. This is where the CMUSieve
171
 
plug-in and the new Sieve plug-in differ:
172
 
 
173
 
 * For CMUSieve, the binary is stored by appending "c" letter after the script
174
 
   name (e.g. ".dovecot.sievec"). If there are errors in the script, the error
175
 
   messages are stored into a ".err" file (e.g. ".dovecot.sieve.err"). This
176
 
   means that deliver must have write access to the directory where the script
177
 
   is stored. Global scripts have the same problem. Either allow deliver to
178
 
   write to the global script's directory, or compile the script before deliver
179
 
   sees it. Scripts can be compiled using the 'sievec' tool.
180
 
 * The new Sieve implementation uses the '.svbin' extension to store compiled
181
 
   Sieve scripts (e.g. ".dovecot.svbin"). If there are errors or warnings in
182
 
   the script, the messages are appended to a ".log" file (e.g.
183
 
   ".dovecot.sieve.log") until it grows too large. When that happens, the old
184
 
   log file is rotated to a ".log.0" file and an empty log file is started.
185
 
   Currently, scripts included using the include extension are compiled into
186
 
   the main binary, meaning that the plug-in only needs write access to the
187
 
   directory where the main script is located. This is also where the log file
188
 
   is always written. Messages that could be of interest to the system
189
 
   administrator are also written to the Dovecot logging facility (usually
190
 
   syslog).
191
 
 
192
 
How to stop using sieve
193
 
-----------------------
194
 
 
195
 
A user may want to stop using his/her own sieve (and maybe return to using
196
 
global sieve script). Or the administrator may want to disable global sieve.
197
 
 
198
 
To stop using sieve, both the .sieve source file and the compiled .sieve *c*
199
 
file must be deleted(or renamed).
 
62
Sieve is implemented as a plugin to deliver [http://wiki.dovecot.org/LDA].
 
63
Currently, two concurrent implementations of the Sieve plugin are available.
 
64
See their pages for specific instructions:
 
65
 
 
66
 * <CMU Sieve> [LDA.Sieve.CMU.txt] uses the Sieve interpreter from the Cyrus
 
67
   project. For Dovecot v1.0 .. v1.2.
 
68
 * <Dovecot Sieve> [LDA.Sieve.Dovecot.txt] is a fully rewritten implementation.
 
69
   For Dovecot v1.2 and newer.
200
70
 
201
71
Features
202
72
--------
203
73
 
204
 
Both implementations of the Sieve plug-in support various extensions to the
205
 
Sieve language. You can find more information about these at the Sieve Mail
 
74
Both Sieve implementations support various extensions to the Sieve language.
 
75
You can find more information about the extensions from the Sieve Mail
206
76
Filtering Language Charter
207
77
[http://www.ietf.org/html.charters/sieve-charter.html] or the Sieve.info wiki
208
78
page [http://www.sieve.info/].
209
79
 
210
 
*NB: Sieve doesn't support running external programs*.
211
 
 
212
 
CMUSieve Plug-in
213
 
----------------
214
 
 
215
 
The CMUSieve plugin v1.0.x code is taken from Cyrus IMAP v2.2.12. The CMUSieve
216
 
plugin v1.1.x code is taken from Cyrus IMAP v2.3.8. Whatever information you
217
 
can find about those versions of Cyrus Sieve, it should also apply to these
218
 
plug-ins.
 
80
Note that Sieve doesn't support running external programs.
219
81
 
220
82
The supported Sieve features are:
221
83
 
222
 
 * fileinto
223
 
 * reject
224
 
 * envelope
225
 
 * vacation
226
 
 * imapflags (old draft specification)
227
 
 * notify (old draft specification)
228
 
 * regex
229
 
 * subaddress
230
 
 * relational
231
 
 * copy (v1.1 only)
232
 
 * body (v1.1 only)
233
 
 * include (v1.1 only)
234
 
 
235
 
New Sieve Plug-in
236
 
-----------------
237
 
 
238
 
The new Sieve plug-in aims to at least match the extensions supported by the
239
 
CMUSieve plug-in:
240
 
 
241
 
 * fileinto
242
 
 * reject
243
 
 * envelope
244
 
 * vacation
245
 
 * imap4flags
246
 
 * regex
247
 
 * subaddress
248
 
 * relational
249
 
 * copy
250
 
 * body
251
 
 * include
252
 
 * encoded-character
253
 
 * variables
254
 
 
255
 
In this respect the notify extension is notably missing. This is currently
256
 
under development. Note that the CMUSieve plug-in implements an older
257
 
specification that calls this extension *notify* and not *enotify* as it is
258
 
called nowadays. Something similar is true for the *imapflags* extension which
259
 
is now called *imap4flags*. The most valuable extension that the new Sieve
260
 
implementation adds to the list is the *variables* extension. As the name
261
 
implies, this adds support for variables to the language.
 
84
 *
 
85
+--------------------------------------------------------------------+-------+-----------+
 
86
| Extension                                                          | CMU   | Dovecot   |
 
87
|                                                                    | Sieve | Sieve     |
 
88
+--------------------------------------------------------------------+-------+-----------+
 
89
| fileinto [http://ietfreport.isoc.org/idref/rfc5228/]               | yes   | yes       |
 
90
+--------------------------------------------------------------------+-------+-----------+
 
91
| reject                                                             | yes   | yes       |
 
92
| [http://ietfreport.isoc.org/idref/draft-ietf-sieve-refuse-reject/] |       |           |
 
93
+--------------------------------------------------------------------+-------+-----------+
 
94
| envelope [http://ietfreport.isoc.org/idref/rfc5228/]               | yes   | yes       |
 
95
+--------------------------------------------------------------------+-------+-----------+
 
96
| vacation [http://ietfreport.isoc.org/idref/rfc5230/]               | yes   | yes       |
 
97
+--------------------------------------------------------------------+-------+-----------+
 
98
| imap4flags [http://ietfreport.isoc.org/idref/rfc5232/]             | no    | yes       |
 
99
+--------------------------------------------------------------------+-------+-----------+
 
100
| imapflags(old draft                                                | yes   | yes       |
 
101
| [http://tools.ietf.org/html/draft-melnikov-sieve-imapflags-03])    |       | (default  |
 
102
|                                                                    |       | disabled) |
 
103
+--------------------------------------------------------------------+-------+-----------+
 
104
| enotify [http://ietfreport.isoc.org/idref/rfc5435/]                | no    | yes       |
 
105
+--------------------------------------------------------------------+-------+-----------+
 
106
| notify (old draft                                                  | yes   | no        |
 
107
| [http://tools.ietf.org/html/draft-ietf-sieve-notify-00])           |       |           |
 
108
+--------------------------------------------------------------------+-------+-----------+
 
109
| regex [http://ietfreport.isoc.org/idref/draft-ietf-sieve-regex/]   | yes   | yes       |
 
110
+--------------------------------------------------------------------+-------+-----------+
 
111
| subaddress [http://ietfreport.isoc.org/idref/rfc5233/]             | yes   | yes       |
 
112
+--------------------------------------------------------------------+-------+-----------+
 
113
| relational [http://ietfreport.isoc.org/idref/rfc5231/]             | yes   | yes       |
 
114
+--------------------------------------------------------------------+-------+-----------+
 
115
| copy [http://ietfreport.isoc.org/idref/rfc3894/]                   | v1.1+ | yes       |
 
116
+--------------------------------------------------------------------+-------+-----------+
 
117
| body [http://ietfreport.isoc.org/idref/rfc5173/]                   | v1.1+ | yes       |
 
118
+--------------------------------------------------------------------+-------+-----------+
 
119
| include                                                            | v1.1+ | yes       |
 
120
| [http://ietfreport.isoc.org/idref/draft-daboo-sieve-include/]      |       |           |
 
121
+--------------------------------------------------------------------+-------+-----------+
 
122
| encoded-character [http://ietfreport.isoc.org/idref/rfc5228/]      | no    | yes       |
 
123
+--------------------------------------------------------------------+-------+-----------+
 
124
| variables [http://ietfreport.isoc.org/idref/rfc5229/]              | no    | yes       |
 
125
+--------------------------------------------------------------------+-------+-----------+
 
126
 
 
127
Note that the CMU Sieve plugin implements an older specification of the
 
128
*enotify* extension which was called *notify*. Something similar is true for
 
129
the *imap4flags* extension, which was known as *imapflags* for CMU Sieve.  For
 
130
backwards compatibility, Dovecot Sieve plugin also supports the old *imapflags*
 
131
extension. The most valuable extension that the new Sieve implementation adds
 
132
to the list is the *variables* extension. As the name implies, this adds
 
133
support for variables to the language.
262
134
 
263
135
ManageSieve server
264
136
------------------
267
139
i.e. without the need for shell or FTP access, you can use the Manage ''Sieve
268
140
protocol. Two alternatives are available for Dovecot:
269
141
 
270
 
 * Python implementation: http://woozle.org/~neale/src/pysieved/
271
 
 * <Dovecot native ManageSieve implementation> [ManageSieve.txt]
 
142
 * <Dovecot's native ManageSieve implementation> [ManageSieve.txt]
 
143
 * Python implementation [http://woozle.org/~neale/src/pysieved/]. Ensure if
 
144
   using TLS that the tlslite library used this patch
 
145
   [http://sourceforge.net/mailarchive/message.php?msg_name=1173243373.1225.TMDA%40tmda.severn.wwwdotorg.org]
272
146
 
273
147
Validate your script
274
148
--------------------
276
150
Use the following page to validate your sieve rules:
277
151
http://libsieve-php.sourceforge.net/
278
152
 
279
 
v1.0 namespaces and fileinto
280
 
----------------------------
 
153
Mailbox names with fileinto
 
154
---------------------------
 
155
 
 
156
With Dovecot v1.1+ you need to give mailbox names to fileinto commands the same
 
157
way as IMAP clients see them. For example if you want to deliver mail to
 
158
"Customers" mailbox which exists under "Work" mailbox:
 
159
 
 
160
 * Namespace with 'prefix=""', 'separator=.' (Maildir default):
 
161
   *Work.Customers*
 
162
 * Namespace with 'prefix=INBOX.', 'separator=.' (Courier migration):
 
163
   *INBOX.Work.Customers*
 
164
 * Namespace with 'prefix=""', 'separator=/' (mbox, dbox default):
 
165
   *Work/Customers*
281
166
 
282
167
Dovecot v1.0's deliver doesn't support namespaces, so if you have a namespace
283
 
prefix configured for IMAP, you must not use it with *fileinto* command. This
284
 
also means that delivering mails to multiple namespaces isn't possible.
285
 
 
286
 
v1.1's deliver supports namespaces and the namespace prefixes must be used with
287
 
*fileinto* commands.
 
168
prefix you must not add it to fileinto and you must use the default separator.
 
169
This also means that delivering mails to multiple namespaces isn't possible
 
170
with v1.0.
288
171
 
289
172
Vacation auto-reply
290
173
-------------------
295
178
    * Envelope sender: Return-Path: header in the message.
296
179
    * Envelope recipient: -d parameter to deliver. If -d isn't given
297
180
      (delivering to system users), the $USER environment is used.
298
 
 * v1.1:
 
181
 * v1.1+:
299
182
    * Envelope sender: -f parameter to deliver if given, otherwise Return-Path:
300
183
      header in the message.
301
184
    * Envelope recipient: -a parameter to deliver if given, otherwise -d
338
221
SpamAssassin tagged mail filtering
339
222
----------------------------------
340
223
 
341
 
Redirect <SpamAssassin.txt> tagged mails into mbox folder "spam":
 
224
Redirect SpamAssassin tagged mails into mbox folder "spam":
342
225
 
343
226
---%<-------------------------------------------------------------------------
344
227
require "fileinto";
347
230
}
348
231
---%<-------------------------------------------------------------------------
349
232
 
350
 
Discard <SpamAssassin.txt> tagged mails:
 
233
Discard SpamAssassin tagged mails:
351
234
 
352
235
---%<-------------------------------------------------------------------------
353
236
if header :contains "X-Spam-Flag" "YES" {
355
238
}
356
239
---%<-------------------------------------------------------------------------
357
240
 
 
241
Plus Addressed mail filtering
 
242
-----------------------------
 
243
 
 
244
This is useful when you don't want just any +tag to create a directory, but you
 
245
want to use tagged addresses such as with amavisd-new.  This example would
 
246
place email addressed to user+spam@example.com into user's Spam folder.
 
247
 
 
248
---%<-------------------------------------------------------------------------
 
249
require ["fileinto", "envelope", "subaddress"];
 
250
if envelope :detail "to" "spam"{
 
251
  fileinto "Spam";
 
252
}
 
253
---%<-------------------------------------------------------------------------
 
254
 
 
255
To work with Postfix, this requires that the envelope "to" still contains the
 
256
full address, so pass it with the -a flag.
 
257
 
 
258
---%<-------------------------------------------------------------------------
 
259
dovecot unix    -       n       n       -       -      pipe
 
260
  flags=DRhu user=mail:mail argv=/usr/local/libexec/dovecot/deliver
 
261
  -f ${sender} -d ${user}@${nexthop} -a ${recipient}
 
262
---%<-------------------------------------------------------------------------
 
263
 
358
264
Mail filtering by various headers
359
265
---------------------------------
360
266
 
375
281
     keep;
376
282
   }
377
283
   ---%<----------------------------------------------------------------------
 
284
 
378
285
   "anyof" means logical OR, "allof" is AND.
379
286
 
380
287
Forward mails with "order" or "buy" in their subject to another address:
441
348
  # Reply at most once a day to a same sender
442
349
  :days 1
443
350
  :subject "Out of office reply"
444
 
  # List of recipient addresses which are included in the auto replying.
445
 
  # If a mail's recipient is not on this list, no vacation reply is sent for
446
 
it.
 
351
  # List of additional recipient addresses which are included in the auto
 
352
replying.
 
353
  # If a mail's recipient is not the envelope recipient and it's not on this
 
354
list,
 
355
  # no vacation reply is sent for it.
447
356
  :addresses ["j.doe@company.dom", "john.doe@company.dom"]
448
357
"I'm out of office, please contact Joan Doe instead.
449
358
Best regards
461
370
include :personal "my-own-spam.sieve";
462
371
---%<-------------------------------------------------------------------------
463
372
 
464
 
If you want to use global scripts, you'll need to set up the global script
465
 
directory:
 
373
The lookup directories can be specified with:
466
374
 
467
375
---%<-------------------------------------------------------------------------
468
 
protocol lda {
469
 
  # ..
 
376
plugin {
 
377
  # Directory for :personal include scripts. The default is to use home
 
378
directory.
 
379
  sieve_dir = %h/sieve
 
380
 
 
381
  # Directory for :global include scripts (not to be confused with
 
382
sieve_global_path).
 
383
  # If unset, the include fails.
470
384
  sieve_global_dir = /etc/dovecot/sieve/
471
385
}
472
386
---%<-------------------------------------------------------------------------
473
387
 
474
 
Personal scripts are looked up from 'sieve_dir' if it's returned in <userdb
475
 
extra fields> [UserDatabase.ExtraFields.txt], or home directory if not. If
476
 
neither is known, the include fails.
 
388
With v1.1 'sieve_dir' should match the 'sieve_storage' setting in the <protocol
 
389
managesieve> [ManageSieve.txt] section. <ManageSieve.txt> v1.2+ uses
 
390
'sieve_dir' directly.
 
391
 
 
392
Both 'sieve_dir' and 'sieve_global_dir' may also be overridden by <userdb extra
 
393
fields> [UserDatabase.ExtraFields.txt].
477
394
 
478
395
It's not currently possible to use subdirectories for the scripts. Having a '/'
479
396
character in the script name always fails the include. This is just an extra
495
412
Here's the original post announcing it:
496
413
http://dovecot.org/list/dovecot/2007-March/020895.html 
497
414
 
498
 
(This file was created from the wiki on 2009-01-05 04:42)
 
415
(This file was created from the wiki on 2009-07-10 04:42)