overrides.texi: Remove.
[bpt/emacs.git] / doc / misc / sieve.texi
CommitLineData
4009494e 1\input texinfo @c -*-texinfo-*-
db78a8cb 2@setfilename ../../info/sieve
4009494e
GM
3@settitle Emacs Sieve Manual
4@synindex fn cp
5@synindex vr cp
6@synindex pg cp
7
8@copying
9This file documents the Emacs Sieve package, for server-side mail filtering.
10
73b0cd50 11Copyright @copyright{} 2001-2011 Free Software Foundation, Inc.
4009494e
GM
12
13@quotation
14Permission is granted to copy, distribute and/or modify this document
6a2c4aec 15under the terms of the GNU Free Documentation License, Version 1.3 or
4009494e 16any later version published by the Free Software Foundation; with no
debf4439
GM
17Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
18and with the Back-Cover Texts as in (a) below. A copy of the license
19is included in the section entitled ``GNU Free Documentation License''.
4009494e 20
6f093307
GM
21(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
22modify this GNU manual. Buying copies from the FSF supports it in
23developing GNU and promoting software freedom.''
4009494e
GM
24@end quotation
25@end copying
26
27@dircategory Emacs
28@direntry
29* Sieve: (sieve). Managing Sieve scripts in Emacs.
30@end direntry
31@iftex
32@finalout
33@end iftex
34@setchapternewpage odd
35
36@titlepage
37@title Emacs Sieve Manual
38
39@author by Simon Josefsson
40@page
41@vskip 0pt plus 1filll
42@insertcopying
43@end titlepage
44
5dc584b5
KB
45@summarycontents
46@contents
4009494e
GM
47
48@node Top
49@top Sieve Support for Emacs
50
5dc584b5 51This is intended as a users manual for Sieve Mode and Manage Sieve, and
4009494e
GM
52as a reference manual for the @samp{sieve-manage} protocol Emacs Lisp
53API.
54
55Sieve is a language for server-side filtering of mail. The language
56is documented in RFC 3028. This manual does not attempt to document
57the language, so keep RFC 3028 around.
58
5dc584b5
KB
59@ifnottex
60@insertcopying
61@end ifnottex
4009494e
GM
62
63@menu
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.
72@end menu
73
74
75@node Installation
76@chapter Installation
77@cindex Install
78@cindex Setup
79
80The Sieve package should come with your Emacs version, and should be
81ready for use directly.
82
83However, to manually set up the package you can put the following
84commands in your @code{~/.emacs}:
85
86@lisp
87(autoload 'sieve-mode "sieve-mode")
88@end lisp
89@lisp
90(setq auto-mode-alist (cons '("\\.s\\(v\\|iv\\|ieve\\)\\'" . sieve-mode)
91 auto-mode-alist))
92@end lisp
93
94
95@node Sieve Mode
96@chapter Sieve Mode
97
98Sieve mode provides syntax-based indentation, font-locking support and
99other handy functions to make editing Sieve scripts easier.
100
101Use @samp{M-x sieve-mode} to switch to this major mode. This command
102runs the hook @code{sieve-mode-hook}.
103
104@vindex sieve-mode-map
105@vindex sieve-mode-syntax-table
106Sieve mode is derived from @code{c-mode}, and is very similar except
107for the syntax of comments. The keymap (@code{sieve-mode-map}) is
108inherited from @code{c-mode}, as are the variables for customizing
109indentation. Sieve mode has its own abbrev table
110(@code{sieve-mode-abbrev-table}) and syntax table
111(@code{sieve-mode-syntax-table}).
112
113In addition to the editing utility functions, Sieve mode also contains
114bindings to manage Sieve scripts remotely. @xref{Managing Sieve}.
115
116@table @kbd
117
118@item C-c RET
119@kindex C-c RET
120@findex sieve-manage
121@cindex manage remote sieve script
122Open a connection to a remote server using the Managesieve protocol.
123
124@item C-c C-l
125@kindex C-c C-l
126@findex sieve-upload
127@cindex upload sieve script
128Upload the Sieve script to the currently open server.
129
130@end table
131
132
133@node Managing Sieve
134@chapter Managing Sieve
135
136Manage Sieve is a special mode used to display Sieve scripts available
137on a remote server. It can be invoked with @kbd{M-x sieve-manage
138RET}, which queries the user for a server and if necessary, user
139credentials to use.
140
141When a server has been successfully contacted, the Manage Sieve buffer
142looks something like:
143
144@example
145Server : mailserver:2000
146
1472 scripts on server, press RET on a script name edits it, or
148press RET on <new script> to create a new script.
149 <new script>
150 ACTIVE .sieve
151 template.siv
152@end example
153
154One of the scripts are highlighted, and standard point navigation
155commands (@kbd{<up>}, @kbd{<down>} etc) can be used to navigate the
156list.
157
158The following commands are available in the Manage Sieve buffer:
159
160@table @kbd
161
162@item m
163@kindex m
164@findex sieve-activate
165Activates the currently highlighted script.
166
167@item u
168@kindex u
169@findex sieve-deactivate
170Deactivates the currently highlighted script.
171
172@item C-M-?
173@kindex C-M-?
174@findex sieve-deactivate-all
175Deactivates all scripts.
176
177@item r
178@kindex r
179@findex sieve-remove
180Remove currently highlighted script.
181
182@item RET
183@item mouse-2
184@item f
185@kindex RET
186@kindex mouse-2
187@kindex f
188@findex sieve-edit-script
189Bury the server buffer and download the currently highlighted script
190into a new buffer for editing in Sieve mode (@pxref{Sieve Mode}).
191
192@item o
193@kindex o
194@findex sieve-edit-script-other-window
195Create a new buffer in another window containing the currently
196highlighted script for editing in Sieve mode (@pxref{Sieve Mode}).
197
198@item q
199@kindex q
200@findex sieve-bury-buffer
201Bury the Manage Sieve buffer without closing the connection.
202
203@item ?
204@item h
205@kindex ?
206@kindex h
207@findex sieve-help
208Displays help in the minibuffer.
209
210@end table
211
212@node Examples
213@chapter Examples
214
215If you are not familiar with Sieve, this chapter contains a few simple
216code snippets that you can cut'n'paste and modify at will, until you
217feel more comfortable with the Sieve language to write the rules from
218scratch.
219
220The following complete Sieve script places all messages with a matching
221@samp{Sender:} header into the given mailbox. Many mailing lists uses
222this format. The first line makes sure your Sieve server understands
223the @code{fileinto} command.
224
225@example
226require "fileinto";
227
228if address "sender" "owner-w3-beta@@xemacs.org" @{
b1fbbb32 229 fileinto "INBOX.w3-beta";
4009494e
GM
230@}
231@end example
232
01c52d31
MB
233A few mailing lists do not use the @samp{Sender:} header, but has a
234unique identifier in some other header. The following is not a
235complete script, it assumes that @code{fileinto} has already been
4009494e
GM
236required.
237
238@example
239if header :contains "Delivered-To" "auc-tex@@sunsite.dk" @{
b1fbbb32 240 fileinto "INBOX.auc-tex";
4009494e
GM
241@}
242@end example
243
244At last, we have the hopeless mailing lists that does not have any
245unique identifier and you are forced to match on the @samp{To:} and
246@samp{Cc} headers. As before, this snippet assumes that @code{fileinto}
247has been required.
248
249@example
250if address ["to", "cc"] "kerberos@@mit.edu" @{
b1fbbb32 251 fileinto "INBOX.kerberos";
4009494e
GM
252@}
253@end example
254
255@node Manage Sieve API
256@chapter Manage Sieve API
257
258The @file{sieve-manage.el} library contains low-level functionality
259for talking to a server with the @sc{managesieve} protocol.
260
261A number of user-visible variables exist, which all can be customized
262in the @code{sieve} group (@kbd{M-x customize-group RET sieve RET}):
263
264@table @code
265
4009494e
GM
266@item sieve-manage-default-port
267@vindex sieve-manage-default-port
268Sets the default port to use, the suggested port number is @code{2000}.
269
270@item sieve-manage-log
271@vindex sieve-manage-log
272If non-@code{nil}, should be a string naming a buffer where a protocol trace
273is dumped (for debugging purposes).
274
275@end table
276
277The API functions include:
278
279@table @code
280
281@item sieve-manage-open
282@findex sieve-manage-open
283Open connection to managesieve server, returning a buffer to be used
284by all other API functions.
285
286@item sieve-manage-opened
287@findex sieve-manage-opened
288Check if a server is open or not.
289
290@item sieve-manage-close
291@findex sieve-manage-close
292Close a server connection.
293
fd9ba500
JD
294@item sieve-manage-authenticate
295@findex sieve-manage-authenticate
296Authenticate to the server.
297
4009494e
GM
298@item sieve-manage-capability
299@findex sieve-manage-capability
300Return a list of capabilities the server supports.
301
302@item sieve-manage-listscripts
303@findex sieve-manage-listscripts
304List scripts on the server.
305
306@item sieve-manage-havespace
307@findex sieve-manage-havespace
308Return non-@code{nil} if the server has room for a script of given
309size.
310
311@item sieve-manage-getscript
312@findex sieve-manage-getscript
313Download script from server.
314
315@item sieve-manage-putscript
316@findex sieve-manage-putscript
317Upload script to server.
318
319@item sieve-manage-setactive
320@findex sieve-manage-setactive
321Indicate which script on the server should be active.
322
323@end table
324
325@node Standards
326@chapter Standards
327
328The Emacs Sieve package implements all or parts of a small but
329hopefully growing number of RFCs and drafts documents. This chapter
330lists the relevant ones. They can all be fetched from
331@uref{http://quimby.gnus.org/notes/}.
332
333@table @dfn
334
335@item RFC3028
336Sieve: A Mail Filtering Language.
337
338@item draft-martin-managesieve-03
339A Protocol for Remotely Managing Sieve Scripts
340
341@end table
342
343@node GNU Free Documentation License
344@appendix GNU Free Documentation License
345@include doclicense.texi
346
347@node Index
348@unnumbered Index
349@printindex cp
350
4009494e
GM
351@bye
352
353@c End: