1 \input texinfo @c -*-texinfo-*-
4 @settitle Emacs Sieve Manual
10 * Sieve: (sieve). Managing Sieve scripts in Emacs.
15 @setchapternewpage odd
19 This file documents the Emacs Sieve package.
21 Copyright (C) 2001 Free Software Foundation, Inc.
23 Permission is granted to copy, distribute and/or modify this document
24 under the terms of the GNU Free Documentation License, Version 1.1 or
25 any later version published by the Free Software Foundation; with no
26 Invariant Sections, with the Front-Cover texts being ``A GNU
27 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
28 license is included in the section entitled ``GNU Free Documentation
29 License'' in the Emacs manual.
31 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
32 this GNU Manual, like GNU software. Copies published by the Free
33 Software Foundation raise funds for GNU development.''
35 This document is part of a collection distributed under the GNU Free
36 Documentation License. If you want to distribute this document
37 separately from the collection, you can do so by adding a copy of the
38 license to the document, as described in section 6 of the license.
44 @title Emacs Sieve Manual
46 @author by Simon Josefsson
49 @vskip 0pt plus 1filll
50 Copyright @copyright{} 2001 Free Software Foundation, Inc.
52 Permission is granted to copy, distribute and/or modify this document
53 under the terms of the GNU Free Documentation License, Version 1.1 or
54 any later version published by the Free Software Foundation; with the
55 Invariant Sections being none, with the Front-Cover texts being ``A GNU
56 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
57 license is included in the section entitled ``GNU Free Documentation
58 License'' in the Emacs manual.
60 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
61 this GNU Manual, like GNU software. Copies published by the Free
62 Software Foundation raise funds for GNU development.''
64 This document is part of a collection distributed under the GNU Free
65 Documentation License. If you want to distribute this document
66 separately from the collection, you can do so by adding a copy of the
67 license to the document, as described in section 6 of the license.
74 @top Sieve Support for Emacs
76 This manual documents the Emacs Sieve package.
78 It is intended as a users manual for Sieve Mode and Manage Sieve, and
79 as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
82 Sieve is a language for server-side filtering of mail. The language
83 is documented in RFC 3028. This manual does not attempt to document
84 the language, so keep RFC 3028 around.
87 * Installation:: Getting ready to use the package.
88 * Sieve Mode:: Editing Sieve scripts.
89 * Managing Sieve:: Managing Sieve scripts on a remote server.
90 * Examples :: A few Sieve code snippets.
91 * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
92 * Standards:: A summary of RFCs and working documents used.
93 * Index:: Function and variable index.
102 The Sieve package should come with your Emacs version, and should be
103 ready for use directly.
105 However, to manually set up the package you can put the following
106 commands in your @code{~/.emacs}:
109 (autoload 'sieve-mode "sieve-mode")
112 (setq auto-mode-alist (cons '("\\.si\\(v\\|eve\\)\\'" . sieve-mode)
120 Sieve mode provides syntax-based indentation, font-locking support and
121 other handy functions to make editing Sieve scripts easier.
123 Use @samp{M-x sieve-mode} to switch to this major mode. This command
124 runs the hook @code{sieve-mode-hook}.
126 @vindex sieve-mode-map
127 @vindex sieve-mode-syntax-table
128 Sieve mode is derived from @code{c-mode}, and is very similar except
129 for the syntax of comments. The keymap (@code{sieve-mode-map}) is
130 inherited from @code{c-mode}, as are the the variables for customizing
131 indentation. Sieve mode has its own abbrev table
132 (@code{sieve-mode-abbrev-table}) and syntax table
133 (@code{sieve-mode-syntax-table}).
135 In addition to the editing utility functions, Sieve mode also contains
136 bindings to manage Sieve scripts remotely. @pxref{Managing Sieve}.
143 @cindex manage remote sieve script
144 Open a connection to a remote server using the Managesieve protocol.
149 @cindex upload sieve script
150 Upload the Sieve script to the currently open server.
156 @chapter Managing Sieve
158 Manage Sieve is a special mode used to display Sieve scripts available
159 on a remote server. It can be invoked with @kbd{M-x sieve-manage
160 RET}, which queries the user for a server and if necessary, user
163 When a server has been succesfully contacted, the Manage Sieve buffer
164 looks something like:
167 Server : mailserver:2000
169 2 scripts on server, press RET on a script name edits it, or
170 press RET on <new script> to create a new script.
176 One of the scripts are highlighted, and standard point navigation
177 commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
180 The following commands are available in the Manage Sieve buffer:
186 @findex sieve-activate
187 Activates the currently highlighted script.
191 @findex sieve-deactivate
192 Deactivates the currently highlighted script.
196 @findex sieve-deactivate-all
197 Deactivates all scripts.
202 Remove currently highlighted script.
210 @findex sieve-edit-script
211 Bury the server buffer and download the currently highlighted script
212 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
216 @findex sieve-edit-script-other-window
217 Create a new buffer in another window containing the currently
218 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
222 @findex sieve-bury-buffer
223 Bury the Manage Sieve buffer without closing the connection.
230 Displays help in the minibuffer.
237 If you are not familiar with Sieve, this chapter contains a few simple
238 code snippets that you can cut'n'paste and modify at will, until you
239 feel more comfortable with the Sieve language to write the rules from
242 The following complete Sieve script places all messages with a matching
243 @samp{Sender:} header into the given mailbox. Many mailing lists uses
244 this format. The first line makes sure your Sieve server understands
245 the @code{fileinto} command.
250 if address "sender" "owner-w3-beta@@xemacs.org" @{
251 fileinto "INBOX.w3-beta";
255 A few mailing lists do not use the @samp{Sender:} header, but does
256 contain some unique identifier in some other header. The following is
257 not a complete script, it assumes that @code{fileinto} has already been
261 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
262 fileinto "INBOX.auc-tex";
266 At last, we have the hopeless mailing lists that does not have any
267 unique identifier and you are forced to match on the @samp{To:} and
268 @samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
272 if address ["to", "cc"] "kerberos@@mit.edu" @{
273 fileinto "INBOX.kerberos";
277 @node Manage Sieve API
278 @chapter Manage Sieve API
280 The @file{sieve-manage.el} library contains low-level functionality
281 for talking to a server with the @sc{managesieve} protocol.
283 A number of user-visible variables exist, which all can be customized
284 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
288 @item sieve-manage-default-user
289 @vindex sieve-manage-default-user
290 Sets the default username.
292 @item sieve-manage-default-port
293 @vindex sieve-manage-default-port
294 Sets the default port to use, the suggested port number is @code{2000}.
296 @item sieve-manage-log
297 @vindex sieve-manage-log
298 If non-nil, should be a string naming a buffer where a protocol trace
299 is dumped (for debugging purposes).
303 The API functions include:
307 @item sieve-manage-open
308 @findex sieve-manage-open
309 Open connection to managesieve server, returning a buffer to be used
310 by all other API functions.
312 @item sieve-manage-opened
313 @findex sieve-manage-opened
314 Check if a server is open or not.
316 @item sieve-manage-close
317 @findex sieve-manage-close
318 Close a server connection.
320 @item sieve-manage-authenticate
321 @findex sieve-manage-authenticate
322 Authenticate to the server.
324 @item sieve-manage-capability
325 @findex sieve-manage-capability
326 Return a list of capabilities the server support.
328 @item sieve-manage-listscripts
329 @findex sieve-manage-listscripts
330 List scripts on the server.
332 @item sieve-manage-havespace
333 @findex sieve-manage-havespace
334 Returns non-nil iff server have roam for a script of given size.
336 @item sieve-manage-getscript
337 @findex sieve-manage-getscript
338 Download script from server.
340 @item sieve-manage-putscript
341 @findex sieve-manage-putscript
342 Upload script to server.
344 @item sieve-manage-setactive
345 @findex sieve-manage-setactive
346 Indicate which script on the server should be active.
353 The Emacs Sieve package implements all or parts of a small but
354 hopefully growing number of RFCs and drafts documents. This chapter
355 lists the relevant ones. They can all be fetched from
356 @samp{http://quimby.gnus.org/notes/}.
361 Sieve: A Mail Filtering Language.
363 @item draft-martin-managesieve-03
364 A Protocol for Remotely Managing Sieve Scripts