1 \input texinfo @c -*-texinfo-*-
4 @settitle Emacs Sieve Manual
10 This file documents the Emacs Sieve package.
12 Copyright (C) 2001 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.1 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 \e$B$3$NJ8=q$r!"%U%j!<%=%U%H%&%'%":bCDH/9T$N
\e(B GNU
\e$B%U%j!<J8=qMxMQ5vBz7@Ls=q
\e(B
24 \e$BBh
\e(B 1.1
\e$BHG$^$?$O$=$l0J9_$NHG$,Dj$a$k>r7o$N2<$GJ#@=!"G[I[!"$"$k$$$OJQ99$9
\e(B
25 \e$B$k$3$H$r5v2D$7$^$9!#JQ99IT2DItJ,$O;XDj$7$^$;$s!#!V
\e(BA GNU Manual
\e$B!W$OI=I=;f
\e(B
26 \e$B%F%-%9%H!"0J2<$N
\e(B (a)
\e$B$ON"I=;f%F%-%9%H$G$9!#$3$NMxMQ5vBz7@Ls=q$NJ#<L$O
\e(B
27 \e$B!V
\e(BEmacs manual
\e$B!W$N!V
\e(BGNU
\e$B%U%j!<J8=qMxMQ5vBz7@Ls=q!W$H$$$&>O$K4^$^$l$F$$$^
\e(B
30 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
31 this GNU Manual, like GNU software. Copies published by the Free
32 Software Foundation raise funds for GNU development.''
34 (a) FSF
\e$B$NN"I=;f%F%-%9%H
\e(B:
\e$B!V$"$J$?$K$O$3$N
\e(B GNU Manual
\e$B$r
\e(B GNU
\e$B%=%U%H%&%'%"
\e(B
35 \e$B$N$h$&$KJ#@=$7$?$jJQ99$9$k<+M3$,$"$j$^$9!#J#@=$O%U%j!<%=%U%H%&%'%":bCD$K
\e(B
36 \e$B$h$C$F=PHG$5$l$^$7$?!#
\e(B(
\e$B%U%j!<%=%U%H%&%'%":bCD$O
\e(B) GNU
\e$B$N3+H/$N$?$a$KI,MW
\e(B
37 \e$B$J;q6b$r=8$a$F$$$^$9!#!W
\e(B
39 This document is part of a collection distributed under the GNU Free
40 Documentation License. If you want to distribute this document
41 separately from the collection, you can do so by adding a copy of the
42 license to the document, as described in section 6 of the license.
44 \e$B$3$NJ8=q$O!V
\e(BGNU
\e$B%U%j!<J8=qMxMQ5vBz7@Ls=q!W$K4p$E$$$FG[I[$5$l$?<}=8Cx:nJ*
\e(B
45 \e$B$N0lIt$G$9!#$b$7$"$J$?$,$3$NJ8=q$r<}=8Cx:nJ*$+$iJ,N%$7$FG[I[$7$?$$$H$-$O!"
\e(B
46 \e$B7@Ls=q$NBh
\e(B 6
\e$B9`$K5-=R$5$l$F$$$k$h$&$K!"J8=q$K7@Ls=q$NJ#<L$rIU2C$9$k$3$H
\e(B
47 \e$B$K$h$C$F!"9T$J$&$3$H$,$G$-$^$9!#
\e(B
53 * Sieve: (sieve-ja). Managing Sieve scripts in Emacs.
58 @setchapternewpage odd
61 @title Emacs Sieve Manual
63 @author by Simon Josefsson
65 @vskip 0pt plus 1filll
71 @top Sieve Support for Emacs
73 This manual documents the Emacs Sieve package.
75 It is intended as a users manual for Sieve Mode and Manage Sieve, and
76 as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
79 Sieve is a language for server-side filtering of mail. The language
80 is documented in RFC 3028. This manual does not attempt to document
81 the language, so keep RFC 3028 around.
83 A good online Sieve resources is @uref{http://www.cyrusoft.com/sieve/}.
86 * Installation:: Getting ready to use the package.
87 * Sieve Mode:: Editing Sieve scripts.
88 * Managing Sieve:: Managing Sieve scripts on a remote server.
89 * Examples :: A few Sieve code snippets.
90 * Manage Sieve API :: Interfacing to the Manage Sieve Protocol API.
91 * Standards:: A summary of RFCs and working documents used.
92 * Index:: Function and variable index.
101 The Sieve package should come with your Emacs version, and should be
102 ready for use directly.
104 However, to manually set up the package you can put the following
105 commands in your @code{~/.emacs}:
108 (autoload 'sieve-mode "sieve-mode")
111 (setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
119 Sieve mode provides syntax-based indentation, font-locking support and
120 other handy functions to make editing Sieve scripts easier.
122 Use @samp{M-x sieve-mode} to switch to this major mode. This command
123 runs the hook @code{sieve-mode-hook}.
125 @vindex sieve-mode-map
126 @vindex sieve-mode-syntax-table
127 Sieve mode is derived from @code{c-mode}, and is very similar except
128 for the syntax of comments. The keymap (@code{sieve-mode-map}) is
129 inherited from @code{c-mode}, as are the variables for customizing
130 indentation. Sieve mode has its own abbrev table
131 (@code{sieve-mode-abbrev-table}) and syntax table
132 (@code{sieve-mode-syntax-table}).
134 In addition to the editing utility functions, Sieve mode also contains
135 bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
142 @cindex manage remote sieve script
143 Open a connection to a remote server using the Managesieve protocol.
148 @cindex upload sieve script
149 Upload the Sieve script to the currently open server.
155 @chapter Managing Sieve
157 Manage Sieve is a special mode used to display Sieve scripts available
158 on a remote server. It can be invoked with @kbd{M-x sieve-manage
159 RET}, which queries the user for a server and if necessary, user
162 When a server has been successfully contacted, the Manage Sieve buffer
163 looks something like:
166 Server : mailserver:2000
168 2 scripts on server, press RET on a script name edits it, or
169 press RET on <new script> to create a new script.
175 One of the scripts are highlighted, and standard point navigation
176 commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
179 The following commands are available in the Manage Sieve buffer:
185 @findex sieve-activate
186 Activates the currently highlighted script.
190 @findex sieve-deactivate
191 Deactivates the currently highlighted script.
195 @findex sieve-deactivate-all
196 Deactivates all scripts.
201 Remove currently highlighted script.
209 @findex sieve-edit-script
210 Bury the server buffer and download the currently highlighted script
211 into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
215 @findex sieve-edit-script-other-window
216 Create a new buffer in another window containing the currently
217 highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
221 @findex sieve-bury-buffer
222 Bury the Manage Sieve buffer without closing the connection.
229 Displays help in the minibuffer.
236 If you are not familiar with Sieve, this chapter contains a few simple
237 code snippets that you can cut'n'paste and modify at will, until you
238 feel more comfortable with the Sieve language to write the rules from
241 The following complete Sieve script places all messages with a matching
242 @samp{Sender:} header into the given mailbox. Many mailing lists uses
243 this format. The first line makes sure your Sieve server understands
244 the @code{fileinto} command.
249 if address "sender" "owner-w3-beta@@xemacs.org" @{
250 fileinto "INBOX.w3-beta";
254 A few mailing lists do not use the @samp{Sender:} header, but does
255 contain some unique identifier in some other header. The following is
256 not a complete script, it assumes that @code{fileinto} has already been
260 if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
261 fileinto "INBOX.auc-tex";
265 At last, we have the hopeless mailing lists that does not have any
266 unique identifier and you are forced to match on the @samp{To:} and
267 @samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
271 if address ["to", "cc"] "kerberos@@mit.edu" @{
272 fileinto "INBOX.kerberos";
276 @node Manage Sieve API
277 @chapter Manage Sieve API
279 The @file{sieve-manage.el} library contains low-level functionality
280 for talking to a server with the @sc{managesieve} protocol.
282 A number of user-visible variables exist, which all can be customized
283 in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
287 @item sieve-manage-default-user
288 @vindex sieve-manage-default-user
289 Sets the default username.
291 @item sieve-manage-default-port
292 @vindex sieve-manage-default-port
293 Sets the default port to use, the suggested port number is @code{2000}.
295 @item sieve-manage-log
296 @vindex sieve-manage-log
297 If non-@code{nil}, should be a string naming a buffer where a protocol trace
298 is dumped (for debugging purposes).
302 The API functions include:
306 @item sieve-manage-open
307 @findex sieve-manage-open
308 Open connection to managesieve server, returning a buffer to be used
309 by all other API functions.
311 @item sieve-manage-opened
312 @findex sieve-manage-opened
313 Check if a server is open or not.
315 @item sieve-manage-close
316 @findex sieve-manage-close
317 Close a server connection.
319 @item sieve-manage-authenticate
320 @findex sieve-manage-authenticate
321 Authenticate to the server.
323 @item sieve-manage-capability
324 @findex sieve-manage-capability
325 Return a list of capabilities the server support.
327 @item sieve-manage-listscripts
328 @findex sieve-manage-listscripts
329 List scripts on the server.
331 @item sieve-manage-havespace
332 @findex sieve-manage-havespace
333 Returns non-@code{nil} iff server have roam for a script of given
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 @uref{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
378 @c coding: iso-2022-7bit
381 @c use-kuten-for-period: t
382 @c use-touten-for-comma: t