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, 2008
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 Manual'',
20 and with the Back-Cover Texts as in (a) below. A copy of the license
21 is included in the section entitled ``GNU Free Documentation License''.
23 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
24 modify this GNU manual. Buying copies from the FSF supports it in
25 developing GNU and promoting software freedom.''
31 * Sieve: (sieve). Managing Sieve scripts in Emacs.
36 @setchapternewpage odd
39 @title Emacs Sieve Manual
41 @author by Simon Josefsson
43 @vskip 0pt plus 1filll
49 @top Sieve Support for Emacs
51 This manual documents the Emacs Sieve package.
53 It is intended as a users manual for Sieve Mode and Manage Sieve, and
54 as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
57 Sieve is a language for server-side filtering of mail. The language
58 is documented in RFC 3028. This manual does not attempt to document
59 the language, so keep RFC 3028 around.
61 A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
64 * Installation:: Getting ready to use the package.
65 * Sieve Mode:: Editing Sieve scripts.
66 * Managing Sieve:: Managing Sieve scripts on a remote server.
67 * Examples :: A few Sieve code snippets.
68 * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
69 * Standards:: A summary of RFCs and working documents used.
70 * GNU Free Documentation License:: The license for this documentation.
71 * Index:: Function and variable index.
80 The Sieve package should come with your Emacs version, and should be
81 ready for use directly.
83 However, to manually set up the package you can put the following
84 commands in your @code{~/.emacs}:
87 (autoload 'sieve-mode "sieve-mode")
90 (setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
98 Sieve mode provides syntax-based indentation, font-locking support and
99 other handy functions to make editing Sieve scripts easier.
101 Use @samp{M-x sieve-mode} to switch to this major mode. This command
102 runs the hook @code{sieve-mode-hook}.
104 @vindex sieve-mode-map
105 @vindex sieve-mode-syntax-table
106 Sieve mode is derived from @code{c-mode}, and is very similar except
107 for the syntax of comments. The keymap (@code{sieve-mode-map}) is
108 inherited from @code{c-mode}, as are the variables for customizing
109 indentation. Sieve mode has its own abbrev table
110 (@code{sieve-mode-abbrev-table}) and syntax table
111 (@code{sieve-mode-syntax-table}).
113 In addition to the editing utility functions, Sieve mode also contains
114 bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
121 @cindex manage remote sieve script
122 Open a connection to a remote server using the Managesieve protocol.
127 @cindex upload sieve script
128 Upload the Sieve script to the currently open server.
134 @chapter Managing Sieve
136 Manage Sieve is a special mode used to display Sieve scripts available
137 on a remote server. It can be invoked with @kbd{M-x sieve-manage
138 RET}, which queries the user for a server and if necessary, user
141 When a server has been successfully contacted, the Manage Sieve buffer
142 looks something like:
145 Server : mailserver:2000
147 2 scripts on server, press RET on a script name edits it, or
148 press RET on <new script> to create a new script.
154 One of the scripts are highlighted, and standard point navigation
155 commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
158 The following commands are available in the Manage Sieve buffer:
164 @findex sieve-activate
165 Activates the currently highlighted script.
169 @findex sieve-deactivate
170 Deactivates the currently highlighted script.
174 @findex sieve-deactivate-all
175 Deactivates all scripts.
180 Remove currently highlighted script.
188 @findex sieve-edit-script
189 Bury the server buffer and download the currently highlighted script
190 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
194 @findex sieve-edit-script-other-window
195 Create a new buffer in another window containing the currently
196 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
200 @findex sieve-bury-buffer
201 Bury the Manage Sieve buffer without closing the connection.
208 Displays help in the minibuffer.
215 If you are not familiar with Sieve, this chapter contains a few simple
216 code snippets that you can cut'n'paste and modify at will, until you
217 feel more comfortable with the Sieve language to write the rules from
220 The following complete Sieve script places all messages with a matching
221 @samp{Sender:} header into the given mailbox. Many mailing lists uses
222 this format. The first line makes sure your Sieve server understands
223 the @code{fileinto} command.
228 if address "sender" "owner-w3-beta@@xemacs.org" @{
229 fileinto "INBOX.w3-beta";
233 A few mailing lists do not use the @samp{Sender:} header, but has a
234 unique identifier in some other header. The following is not a
235 complete script, it assumes that @code{fileinto} has already been
239 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
240 fileinto "INBOX.auc-tex";
244 At last, we have the hopeless mailing lists that does not have any
245 unique identifier and you are forced to match on the @samp{To:} and
246 @samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
250 if address ["to", "cc"] "kerberos@@mit.edu" @{
251 fileinto "INBOX.kerberos";
255 @node Manage Sieve API
256 @chapter Manage Sieve API
258 The @file{sieve-manage.el} library contains low-level functionality
259 for talking to a server with the @sc{managesieve} protocol.
261 A number of user-visible variables exist, which all can be customized
262 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
266 @item sieve-manage-default-user
267 @vindex sieve-manage-default-user
268 Sets the default username.
270 @item sieve-manage-default-port
271 @vindex sieve-manage-default-port
272 Sets the default port to use, the suggested port number is @code{2000}.
274 @item sieve-manage-log
275 @vindex sieve-manage-log
276 If non-@code{nil}, should be a string naming a buffer where a protocol trace
277 is dumped (for debugging purposes).
281 The API functions include:
285 @item sieve-manage-open
286 @findex sieve-manage-open
287 Open connection to managesieve server, returning a buffer to be used
288 by all other API functions.
290 @item sieve-manage-opened
291 @findex sieve-manage-opened
292 Check if a server is open or not.
294 @item sieve-manage-close
295 @findex sieve-manage-close
296 Close a server connection.
298 @item sieve-manage-authenticate
299 @findex sieve-manage-authenticate
300 Authenticate to the server.
302 @item sieve-manage-capability
303 @findex sieve-manage-capability
304 Return a list of capabilities the server supports.
306 @item sieve-manage-listscripts
307 @findex sieve-manage-listscripts
308 List scripts on the server.
310 @item sieve-manage-havespace
311 @findex sieve-manage-havespace
312 Return non-@code{nil} if the server has room for a script of given
315 @item sieve-manage-getscript
316 @findex sieve-manage-getscript
317 Download script from server.
319 @item sieve-manage-putscript
320 @findex sieve-manage-putscript
321 Upload script to server.
323 @item sieve-manage-setactive
324 @findex sieve-manage-setactive
325 Indicate which script on the server should be active.
332 The Emacs Sieve package implements all or parts of a small but
333 hopefully growing number of RFCs and drafts documents. This chapter
334 lists the relevant ones. They can all be fetched from
335 @uref{http://quimby.gnus.org/notes/}.
340 Sieve: A Mail Filtering Language.
342 @item draft-martin-managesieve-03
343 A Protocol for Remotely Managing Sieve Scripts
347 @node GNU Free Documentation License
348 @appendix GNU Free Documentation License
349 @include doclicense.texi
362 arch-tag: 6e3ad0af-2eaf-4f35-a081-d40f4a683ec3