1 \input texinfo @c -*-texinfo-*-
3 @setfilename ../info/sieve
4 @settitle Emacs Sieve Manual
10 This file documents the Emacs Sieve package, for server-side mail filtering.
12 Copyright @copyright{} 2001, 2002, 2003, 2004, 2005, 2006, 2007
13 Free Software Foundation, Inc.
16 Permission is granted to copy, distribute and/or modify this document
17 under the terms of the GNU Free Documentation License, Version 1.2 or
18 any later version published by the Free Software Foundation; with no
19 Invariant Sections, with the Front-Cover texts being ``A GNU
20 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
21 license is included in the section entitled ``GNU Free Documentation
22 License'' in the Emacs manual.
24 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
25 this GNU Manual, like GNU software. Copies published by the Free
26 Software Foundation raise funds for GNU development.''
28 This document is part of a collection distributed under the GNU Free
29 Documentation License. If you want to distribute this document
30 separately from the collection, you can do so by adding a copy of the
31 license to the document, as described in section 6 of the license.
37 * Sieve: (sieve). Managing Sieve scripts in Emacs.
42 @setchapternewpage odd
45 @title Emacs Sieve Manual
47 @author by Simon Josefsson
49 @vskip 0pt plus 1filll
55 @top Sieve Support for Emacs
57 This manual documents the Emacs Sieve package.
59 It is intended as a users manual for Sieve Mode and Manage Sieve, and
60 as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
63 Sieve is a language for server-side filtering of mail. The language
64 is documented in RFC 3028. This manual does not attempt to document
65 the language, so keep RFC 3028 around.
67 A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
70 * Installation:: Getting ready to use the package.
71 * Sieve Mode:: Editing Sieve scripts.
72 * Managing Sieve:: Managing Sieve scripts on a remote server.
73 * Examples :: A few Sieve code snippets.
74 * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
75 * Standards:: A summary of RFCs and working documents used.
76 * GNU Free Documentation License:: The license for this documentation.
77 * Index:: Function and variable index.
86 The Sieve package should come with your Emacs version, and should be
87 ready for use directly.
89 However, to manually set up the package you can put the following
90 commands in your @code{~/.emacs}:
93 (autoload 'sieve-mode "sieve-mode")
96 (setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
104 Sieve mode provides syntax-based indentation, font-locking support and
105 other handy functions to make editing Sieve scripts easier.
107 Use @samp{M-x sieve-mode} to switch to this major mode. This command
108 runs the hook @code{sieve-mode-hook}.
110 @vindex sieve-mode-map
111 @vindex sieve-mode-syntax-table
112 Sieve mode is derived from @code{c-mode}, and is very similar except
113 for the syntax of comments. The keymap (@code{sieve-mode-map}) is
114 inherited from @code{c-mode}, as are the variables for customizing
115 indentation. Sieve mode has its own abbrev table
116 (@code{sieve-mode-abbrev-table}) and syntax table
117 (@code{sieve-mode-syntax-table}).
119 In addition to the editing utility functions, Sieve mode also contains
120 bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
127 @cindex manage remote sieve script
128 Open a connection to a remote server using the Managesieve protocol.
133 @cindex upload sieve script
134 Upload the Sieve script to the currently open server.
140 @chapter Managing Sieve
142 Manage Sieve is a special mode used to display Sieve scripts available
143 on a remote server. It can be invoked with @kbd{M-x sieve-manage
144 RET}, which queries the user for a server and if necessary, user
147 When a server has been successfully contacted, the Manage Sieve buffer
148 looks something like:
151 Server : mailserver:2000
153 2 scripts on server, press RET on a script name edits it, or
154 press RET on <new script> to create a new script.
160 One of the scripts are highlighted, and standard point navigation
161 commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
164 The following commands are available in the Manage Sieve buffer:
170 @findex sieve-activate
171 Activates the currently highlighted script.
175 @findex sieve-deactivate
176 Deactivates the currently highlighted script.
180 @findex sieve-deactivate-all
181 Deactivates all scripts.
186 Remove currently highlighted script.
194 @findex sieve-edit-script
195 Bury the server buffer and download the currently highlighted script
196 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
200 @findex sieve-edit-script-other-window
201 Create a new buffer in another window containing the currently
202 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
206 @findex sieve-bury-buffer
207 Bury the Manage Sieve buffer without closing the connection.
214 Displays help in the minibuffer.
221 If you are not familiar with Sieve, this chapter contains a few simple
222 code snippets that you can cut'n'paste and modify at will, until you
223 feel more comfortable with the Sieve language to write the rules from
226 The following complete Sieve script places all messages with a matching
227 @samp{Sender:} header into the given mailbox. Many mailing lists uses
228 this format. The first line makes sure your Sieve server understands
229 the @code{fileinto} command.
234 if address "sender" "owner-w3-beta@@xemacs.org" @{
235 fileinto "INBOX.w3-beta";
239 A few mailing lists do not use the @samp{Sender:} header, but does
240 contain some unique identifier in some other header. The following is
241 not a complete script, it assumes that @code{fileinto} has already been
245 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
246 fileinto "INBOX.auc-tex";
250 At last, we have the hopeless mailing lists that does not have any
251 unique identifier and you are forced to match on the @samp{To:} and
252 @samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
256 if address ["to", "cc"] "kerberos@@mit.edu" @{
257 fileinto "INBOX.kerberos";
261 @node Manage Sieve API
262 @chapter Manage Sieve API
264 The @file{sieve-manage.el} library contains low-level functionality
265 for talking to a server with the @sc{managesieve} protocol.
267 A number of user-visible variables exist, which all can be customized
268 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
272 @item sieve-manage-default-user
273 @vindex sieve-manage-default-user
274 Sets the default username.
276 @item sieve-manage-default-port
277 @vindex sieve-manage-default-port
278 Sets the default port to use, the suggested port number is @code{2000}.
280 @item sieve-manage-log
281 @vindex sieve-manage-log
282 If non-@code{nil}, should be a string naming a buffer where a protocol trace
283 is dumped (for debugging purposes).
287 The API functions include:
291 @item sieve-manage-open
292 @findex sieve-manage-open
293 Open connection to managesieve server, returning a buffer to be used
294 by all other API functions.
296 @item sieve-manage-opened
297 @findex sieve-manage-opened
298 Check if a server is open or not.
300 @item sieve-manage-close
301 @findex sieve-manage-close
302 Close a server connection.
304 @item sieve-manage-authenticate
305 @findex sieve-manage-authenticate
306 Authenticate to the server.
308 @item sieve-manage-capability
309 @findex sieve-manage-capability
310 Return a list of capabilities the server support.
312 @item sieve-manage-listscripts
313 @findex sieve-manage-listscripts
314 List scripts on the server.
316 @item sieve-manage-havespace
317 @findex sieve-manage-havespace
318 Returns non-@code{nil} iff server have roam for a script of given
321 @item sieve-manage-getscript
322 @findex sieve-manage-getscript
323 Download script from server.
325 @item sieve-manage-putscript
326 @findex sieve-manage-putscript
327 Upload script to server.
329 @item sieve-manage-setactive
330 @findex sieve-manage-setactive
331 Indicate which script on the server should be active.
338 The Emacs Sieve package implements all or parts of a small but
339 hopefully growing number of RFCs and drafts documents. This chapter
340 lists the relevant ones. They can all be fetched from
341 @uref{http://quimby.gnus.org/notes/}.
346 Sieve: A Mail Filtering Language.
348 @item draft-martin-managesieve-03
349 A Protocol for Remotely Managing Sieve Scripts
353 @node GNU Free Documentation License
354 @appendix GNU Free Documentation License
355 @include doclicense.texi
368 arch-tag: 6e3ad0af-2eaf-4f35-a081-d40f4a683ec3