1 \input texinfo @c -*-texinfo-*-
3 @include gnus-overrides.texi
5 @setfilename ../../info/sieve
6 @settitle Emacs Sieve Manual
12 This file documents the Emacs Sieve package, for server-side mail filtering.
14 Copyright @copyright{} 2001--2013 Free Software Foundation, Inc.
17 Permission is granted to copy, distribute and/or modify this document
18 under the terms of the GNU Free Documentation License, Version 1.3 or
19 any later version published by the Free Software Foundation; with no
20 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
21 and with the Back-Cover Texts as in (a) below. A copy of the license
22 is included in the section entitled ``GNU Free Documentation License''.
24 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
25 modify this GNU manual.''
29 @dircategory Emacs network features
31 * Sieve: (sieve). Managing Sieve scripts in Emacs.
36 @setchapternewpage odd
40 @title Emacs Sieve Manual (DEVELOPMENT VERSION)
43 @title Emacs Sieve Manual
46 @author by Simon Josefsson
48 @vskip 0pt plus 1filll
56 @top Sieve Support for Emacs
58 This is intended as a users manual for Sieve Mode and Manage Sieve, and
59 as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
62 Sieve is a language for server-side filtering of mail. The language
63 is documented in RFC 3028. This manual does not attempt to document
64 the language, so keep RFC 3028 around.
71 * Installation:: Getting ready to use the package.
72 * Sieve Mode:: Editing Sieve scripts.
73 * Managing Sieve:: Managing Sieve scripts on a remote server.
74 * Examples :: A few Sieve code snippets.
75 * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
76 * Standards:: A summary of RFCs and working documents used.
77 * GNU Free Documentation License:: The license for this documentation.
78 * Index:: Function and variable index.
87 The Sieve package should come with your Emacs version, and should be
88 ready for use directly.
90 However, to manually set up the package you can put the following
91 commands in your @code{~/.emacs}:
94 (autoload 'sieve-mode "sieve-mode")
97 (setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
105 Sieve mode provides syntax-based indentation, font-locking support and
106 other handy functions to make editing Sieve scripts easier.
108 Use @samp{M-x sieve-mode} to switch to this major mode. This command
109 runs the hook @code{sieve-mode-hook}.
111 @vindex sieve-mode-map
112 @vindex sieve-mode-syntax-table
113 Sieve mode is derived from @code{c-mode}, and is very similar except
114 for the syntax of comments. The keymap (@code{sieve-mode-map}) is
115 inherited from @code{c-mode}, as are the variables for customizing
116 indentation. Sieve mode has its own abbrev table
117 (@code{sieve-mode-abbrev-table}) and syntax table
118 (@code{sieve-mode-syntax-table}).
120 In addition to the editing utility functions, Sieve mode also contains
121 bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
128 @cindex manage remote sieve script
129 Open a connection to a remote server using the Managesieve protocol.
134 @cindex upload sieve script
135 Upload the Sieve script to the currently open server.
141 @chapter Managing Sieve
143 Manage Sieve is a special mode used to display Sieve scripts available
144 on a remote server. It can be invoked with @kbd{M-x sieve-manage
145 RET}, which queries the user for a server and if necessary, user
148 When a server has been successfully contacted, the Manage Sieve buffer
149 looks something like:
152 Server : mailserver:sieve
154 2 scripts on server, press RET on a script name edits it, or
155 press RET on <new script> to create a new script.
161 One of the scripts are highlighted, and standard point navigation
162 commands (@kbd{<up>}, @kbd{<down>} etc.)@: can be used to navigate the
165 The following commands are available in the Manage Sieve buffer:
171 @findex sieve-activate
172 Activates the currently highlighted script.
176 @findex sieve-deactivate
177 Deactivates the currently highlighted script.
181 @findex sieve-deactivate-all
182 Deactivates all scripts.
187 Remove currently highlighted script.
195 @findex sieve-edit-script
196 Bury the server buffer and download the currently highlighted script
197 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
201 @findex sieve-edit-script-other-window
202 Create a new buffer in another window containing the currently
203 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
207 @findex sieve-bury-buffer
208 Bury the Manage Sieve buffer without closing the connection.
215 Displays help in the minibuffer.
219 @findex sieve-manage-quit
220 Quit Manage Sieve and close the connection.
227 If you are not familiar with Sieve, this chapter contains a few simple
228 code snippets that you can cut'n'paste and modify at will, until you
229 feel more comfortable with the Sieve language to write the rules from
232 The following complete Sieve script places all messages with a matching
233 @samp{Sender:} header into the given mailbox. Many mailing lists uses
234 this format. The first line makes sure your Sieve server understands
235 the @code{fileinto} command.
240 if address "sender" "owner-w3-beta@@xemacs.org" @{
241 fileinto "INBOX.w3-beta";
245 A few mailing lists do not use the @samp{Sender:} header, but has a
246 unique identifier in some other header. The following is not a
247 complete script, it assumes that @code{fileinto} has already been
251 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
252 fileinto "INBOX.auc-tex";
256 At last, we have the hopeless mailing lists that does not have any
257 unique identifier and you are forced to match on the @samp{To:} and
258 @samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
262 if address ["to", "cc"] "kerberos@@mit.edu" @{
263 fileinto "INBOX.kerberos";
267 @node Manage Sieve API
268 @chapter Manage Sieve API
270 The @file{sieve-manage.el} library contains low-level functionality
271 for talking to a server with the @sc{managesieve} protocol.
273 A number of user-visible variables exist, which all can be customized
274 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
278 @item sieve-manage-default-port
279 @vindex sieve-manage-default-port
280 Sets the default port to use, the suggested port number is @code{2000}.
282 @item sieve-manage-log
283 @vindex sieve-manage-log
284 If non-@code{nil}, should be a string naming a buffer where a protocol trace
285 is dumped (for debugging purposes).
289 The API functions include:
293 @item sieve-manage-open
294 @findex sieve-manage-open
295 Open connection to managesieve server, returning a buffer to be used
296 by all other API functions.
298 @item sieve-manage-opened
299 @findex sieve-manage-opened
300 Check if a server is open or not.
302 @item sieve-manage-close
303 @findex sieve-manage-close
304 Close a server connection.
306 @item sieve-manage-authenticate
307 @findex sieve-manage-authenticate
308 Authenticate to the server.
310 @item sieve-manage-capability
311 @findex sieve-manage-capability
312 Return a list of capabilities the server supports.
314 @item sieve-manage-listscripts
315 @findex sieve-manage-listscripts
316 List scripts on the server.
318 @item sieve-manage-havespace
319 @findex sieve-manage-havespace
320 Return non-@code{nil} if the server has room for a script of given
323 @item sieve-manage-getscript
324 @findex sieve-manage-getscript
325 Download script from server.
327 @item sieve-manage-putscript
328 @findex sieve-manage-putscript
329 Upload script to server.
331 @item sieve-manage-setactive
332 @findex sieve-manage-setactive
333 Indicate which script on the server should be active.
340 The Emacs Sieve package implements all or parts of a small but
341 hopefully growing number of RFCs and drafts documents. This chapter
342 lists the relevant ones. They can all be fetched from
343 @uref{http://quimby.gnus.org/notes/}.
348 Sieve: A Mail Filtering Language.
351 A Protocol for Remotely Managing Sieve Scripts
355 @node GNU Free Documentation License
356 @appendix GNU Free Documentation License
357 @include doclicense.texi