1 \input texinfo @c -*-texinfo-*-
3 @setfilename ../info/sieve
4 @settitle Emacs Sieve Manual
10 This file documents the Emacs Sieve package.
12 Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
15 Permission is granted to copy, distribute and/or modify this document
16 under the terms of the GNU Free Documentation License, Version 1.2 or
17 any later version published by the Free Software Foundation; with no
18 Invariant Sections, with the Front-Cover texts being ``A GNU
19 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
20 license is included in the section entitled ``GNU Free Documentation
21 License'' in the Emacs manual.
23 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
24 this GNU Manual, like GNU software. Copies published by the Free
25 Software Foundation raise funds for GNU development.''
27 This document is part of a collection distributed under the GNU Free
28 Documentation License. If you want to distribute this document
29 separately from the collection, you can do so by adding a copy of the
30 license to the document, as described in section 6 of the license.
36 * Sieve: (sieve). Managing Sieve scripts in Emacs.
41 @setchapternewpage odd
44 @title Emacs Sieve Manual
46 @author by Simon Josefsson
48 @vskip 0pt plus 1filll
54 @top Sieve Support for Emacs
56 This manual documents the Emacs Sieve package.
58 It 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.
66 A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
69 * Installation:: Getting ready to use the package.
70 * Sieve Mode:: Editing Sieve scripts.
71 * Managing Sieve:: Managing Sieve scripts on a remote server.
72 * Examples :: A few Sieve code snippets.
73 * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
74 * Standards:: A summary of RFCs and working documents used.
75 * Index:: Function and variable index.
84 The Sieve package should come with your Emacs version, and should be
85 ready for use directly.
87 However, to manually set up the package you can put the following
88 commands in your @code{~/.emacs}:
91 (autoload 'sieve-mode "sieve-mode")
94 (setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
102 Sieve mode provides syntax-based indentation, font-locking support and
103 other handy functions to make editing Sieve scripts easier.
105 Use @samp{M-x sieve-mode} to switch to this major mode. This command
106 runs the hook @code{sieve-mode-hook}.
108 @vindex sieve-mode-map
109 @vindex sieve-mode-syntax-table
110 Sieve mode is derived from @code{c-mode}, and is very similar except
111 for the syntax of comments. The keymap (@code{sieve-mode-map}) is
112 inherited from @code{c-mode}, as are the variables for customizing
113 indentation. Sieve mode has its own abbrev table
114 (@code{sieve-mode-abbrev-table}) and syntax table
115 (@code{sieve-mode-syntax-table}).
117 In addition to the editing utility functions, Sieve mode also contains
118 bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
125 @cindex manage remote sieve script
126 Open a connection to a remote server using the Managesieve protocol.
131 @cindex upload sieve script
132 Upload the Sieve script to the currently open server.
138 @chapter Managing Sieve
140 Manage Sieve is a special mode used to display Sieve scripts available
141 on a remote server. It can be invoked with @kbd{M-x sieve-manage
142 RET}, which queries the user for a server and if necessary, user
145 When a server has been successfully contacted, the Manage Sieve buffer
146 looks something like:
149 Server : mailserver:2000
151 2 scripts on server, press RET on a script name edits it, or
152 press RET on <new script> to create a new script.
158 One of the scripts are highlighted, and standard point navigation
159 commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
162 The following commands are available in the Manage Sieve buffer:
168 @findex sieve-activate
169 Activates the currently highlighted script.
173 @findex sieve-deactivate
174 Deactivates the currently highlighted script.
178 @findex sieve-deactivate-all
179 Deactivates all scripts.
184 Remove currently highlighted script.
192 @findex sieve-edit-script
193 Bury the server buffer and download the currently highlighted script
194 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
198 @findex sieve-edit-script-other-window
199 Create a new buffer in another window containing the currently
200 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
204 @findex sieve-bury-buffer
205 Bury the Manage Sieve buffer without closing the connection.
212 Displays help in the minibuffer.
219 If you are not familiar with Sieve, this chapter contains a few simple
220 code snippets that you can cut'n'paste and modify at will, until you
221 feel more comfortable with the Sieve language to write the rules from
224 The following complete Sieve script places all messages with a matching
225 @samp{Sender:} header into the given mailbox. Many mailing lists uses
226 this format. The first line makes sure your Sieve server understands
227 the @code{fileinto} command.
232 if address "sender" "owner-w3-beta@@xemacs.org" @{
233 fileinto "INBOX.w3-beta";
237 A few mailing lists do not use the @samp{Sender:} header, but does
238 contain some unique identifier in some other header. The following is
239 not a complete script, it assumes that @code{fileinto} has already been
243 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
244 fileinto "INBOX.auc-tex";
248 At last, we have the hopeless mailing lists that does not have any
249 unique identifier and you are forced to match on the @samp{To:} and
250 @samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
254 if address ["to", "cc"] "kerberos@@mit.edu" @{
255 fileinto "INBOX.kerberos";
259 @node Manage Sieve API
260 @chapter Manage Sieve API
262 The @file{sieve-manage.el} library contains low-level functionality
263 for talking to a server with the @sc{managesieve} protocol.
265 A number of user-visible variables exist, which all can be customized
266 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
270 @item sieve-manage-default-user
271 @vindex sieve-manage-default-user
272 Sets the default username.
274 @item sieve-manage-default-port
275 @vindex sieve-manage-default-port
276 Sets the default port to use, the suggested port number is @code{2000}.
278 @item sieve-manage-log
279 @vindex sieve-manage-log
280 If non-@code{nil}, should be a string naming a buffer where a protocol trace
281 is dumped (for debugging purposes).
285 The API functions include:
289 @item sieve-manage-open
290 @findex sieve-manage-open
291 Open connection to managesieve server, returning a buffer to be used
292 by all other API functions.
294 @item sieve-manage-opened
295 @findex sieve-manage-opened
296 Check if a server is open or not.
298 @item sieve-manage-close
299 @findex sieve-manage-close
300 Close a server connection.
302 @item sieve-manage-authenticate
303 @findex sieve-manage-authenticate
304 Authenticate to the server.
306 @item sieve-manage-capability
307 @findex sieve-manage-capability
308 Return a list of capabilities the server support.
310 @item sieve-manage-listscripts
311 @findex sieve-manage-listscripts
312 List scripts on the server.
314 @item sieve-manage-havespace
315 @findex sieve-manage-havespace
316 Returns non-@code{nil} iff server have roam for a script of given
319 @item sieve-manage-getscript
320 @findex sieve-manage-getscript
321 Download script from server.
323 @item sieve-manage-putscript
324 @findex sieve-manage-putscript
325 Upload script to server.
327 @item sieve-manage-setactive
328 @findex sieve-manage-setactive
329 Indicate which script on the server should be active.
336 The Emacs Sieve package implements all or parts of a small but
337 hopefully growing number of RFCs and drafts documents. This chapter
338 lists the relevant ones. They can all be fetched from
339 @uref{http://quimby.gnus.org/notes/}.
344 Sieve: A Mail Filtering Language.
346 @item draft-martin-managesieve-03
347 A Protocol for Remotely Managing Sieve Scripts
363 arch-tag: 6e3ad0af-2eaf-4f35-a081-d40f4a683ec3