X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/4f5788623ab3e8456ad254883b6cc018079aab96..da3ad30dcfbb4770835c2b7e165bb719f76cfc16:/doc/doc-docbook/filter.xfpt diff --git a/doc/doc-docbook/filter.xfpt b/doc/doc-docbook/filter.xfpt index c281d215f..b0e176205 100644 --- a/doc/doc-docbook/filter.xfpt +++ b/doc/doc-docbook/filter.xfpt @@ -1,5 +1,3 @@ -. $Cambridge: exim/doc/doc-docbook/filter.xfpt,v 1.2 2006/04/04 14:03:49 ph10 Exp $ - . ///////////////////////////////////////////////////////////////////////////// . This is the primary source of the document that describes Exim's filtering . facilities. It is an xfpt document that is converted into DocBook XML for @@ -11,6 +9,24 @@ .include stdflags .include stdmacs .docbook + +. ///////////////////////////////////////////////////////////////////////////// +. These lines are processing instructions for the Simple DocBook Processor that +. Philip Hazel has developed as a less cumbersome way of making PostScript and +. PDFs than using xmlto and fop. They will be ignored by all other XML +. processors. +. ///////////////////////////////////////////////////////////////////////////// + +.literal xml + +.literal off + .book . =========================================================================== @@ -29,37 +45,44 @@ . =========================================================================== +. ///////////////////////////////////////////////////////////////////////////// +. ///////////////////////////////////////////////////////////////////////////// + . This preliminary stuff creates a entry in the XML. This is removed . when creating the PostScript/PDF output, because we do not want a full-blown -. title page created for those versions. The stylesheet fudges up a title line -. to replace the text "Table of contents". However, for the other forms of -. output, the element is retained and used. +. title page created for those versions. When fop is being used to create +. PS/PDF, the stylesheet fudges up a title line to replace the text "Table of +. contents". When SDoP is being used, a processing instruction does this job. +. For the other forms of output, the element is retained and used. .literal xml Exim's interfaces to mail filtering Exim filtering -04 April 2006 +23 November 2009 PhilipHazel PH - 4.61 - 04 April 2006 + 4.77 + 10 Oct 2011 PH -2006University of Cambridge +2010University of Cambridge .literal off +. ///////////////////////////////////////////////////////////////////////////// +. ///////////////////////////////////////////////////////////////////////////// + -.chapter "Forwarding and filtering in Exim" +.chapter "Forwarding and filtering in Exim" "CHAPforandfilt" This document describes the user interfaces to Exim's in-built mail filtering -facilities, and is copyright © University of Cambridge 2006. It -corresponds to Exim version 4.61. +facilities, and is copyright © University of Cambridge 2007. It +corresponds to Exim version 4.77. -.section "Introduction" +.section "Introduction" "SEC00" Most Unix mail transfer agents (programs that deliver mail) permit individual users to specify automatic forwarding of their mail, usually by placing a list of forwarding addresses in a file called &_.forward_& in their home @@ -102,7 +125,7 @@ up and control the use of filtering. -.section "Filter operation" +.section "Filter operation" "SEC01" It is important to realize that, in Exim, no deliveries are actually made while a filter or traditional &_.forward_& file is being processed. Running a filter or processing a traditional &_.forward_& file sets up future delivery @@ -197,7 +220,7 @@ part. These are relevant only when support for multiple personal mailboxes is implemented; see the description in section &<>& below. -.section "Installing a filter file" +.section "Installing a filter file" "SEC02" A filter file is normally installed under the name &_.forward_& in your home directory &-- it is distinguished from a conventional &_.forward_& file by its first line (described below). However, the file name is configurable, and some @@ -205,7 +228,7 @@ system administrators may choose to use some different name or location for filter files. -.section "Testing an installed filter file" +.section "Testing an installed filter file" "SEC03" Testing a filter file before installation cannot find every potential problem; for example, it does not actually run commands to which messages are piped. Some &"live"& tests should therefore also be done once a filter is installed. @@ -231,7 +254,7 @@ be left in all Exim filter files. (This does not apply to Sieve files.) -.section "Details of filtering commands" +.section "Details of filtering commands" "SEC04" The filtering commands for Sieve and Exim filters are completely different in syntax and semantics. The Sieve mechanism is defined in RFC 3028; in the next chapter we describe how it is integrated into Exim. The subsequent chapter @@ -249,17 +272,18 @@ This chapter does not contain a description of Sieve, since that can be found in RFC 3028, which should be read in conjunction with these notes. The Exim Sieve implementation offers the core as defined by RFC 3028, -comparison tests, the &*copy*&, &*envelope*&, &*fileinto*&, and &*vacation*& -extensions, but not the &*reject*& extension. Exim does not support message -delivery notifications (MDNs), so adding it just to the Sieve filter (as -required for &*reject*&) makes little sense. +comparison tests, the subaddress parameter, the &*copy*&, &*envelope*&, +&*fileinto*&, &*notify*&, and &*vacation*& extensions, but not the &*reject*& +extension. Exim does not support message delivery notifications (MDNs), so +adding it just to the Sieve filter (as required for &*reject*&) makes little +sense. In order for Sieve to work properly in Exim, the system administrator needs to make some adjustments to the Exim configuration. These are described in the chapter on the &(redirect)& router in the full Exim specification. -.section "Recognition of Sieve filters" +.section "Recognition of Sieve filters" "SEC05" A filter file is interpreted as a Sieve filter if its first line is .code # Sieve filter @@ -269,7 +293,7 @@ filter file. -.section "Saving to specified folders" +.section "Saving to specified folders" "SEC06" If the system administrator has set things up as suggested in the Exim specification, and you use &(keep)& or &(fileinto)& to save a mail into a folder, absolute files are stored where specified, relative files are stored @@ -277,7 +301,7 @@ relative to &$home$&, and &_inbox_& goes to the standard mailbox location. -.section "Strings containing header names" +.section "Strings containing header names" "SEC07" RFC 3028 does not specify what happens if a string denoting a header field does not contain a valid header name, for example, it contains a colon. This implementation generates an error instead of ignoring the header field in order @@ -285,7 +309,7 @@ to ease script debugging, which fits in with the common picture of Sieve. -.section "Exists test with empty list of headers" +.section "Exists test with empty list of headers" "SEC08" The &*exists*& test succeeds only if all the specified headers exist. RFC 3028 does not explicitly specify what happens on an empty list of headers. This implementation evaluates that condition as true, interpreting the RFC in a @@ -293,7 +317,7 @@ strict sense. -.section "Header test with invalid MIME encoding in header" +.section "Header test with invalid MIME encoding in header" "SEC09" Some MUAs process invalid base64 encoded data, generating junk. Others ignore junk after seeing an equal sign in base64 encoded data. RFC 2047 does not specify how to react in this case, other than stating that a client must not @@ -309,7 +333,7 @@ character set cannot be converted to UTF-8. -.section "Address test for multiple addresses per header" +.section "Address test for multiple addresses per header" "SEC10" A header may contain multiple addresses. RFC 3028 does not explicitly specify how to deal with them, but since the address test checks if anything matches anything else, matching one address suffices to satisfy the condition. That @@ -319,7 +343,7 @@ contains an additional address besides the one the test checks for. -.section "Semantics of keep" +.section "Semantics of keep" "SEC11" The &(keep)& command is equivalent to .code fileinto "inbox"; @@ -329,7 +353,7 @@ implicit keep flag; there is no command to set it once it has been reset. -.section "Semantics of fileinto" +.section "Semantics of fileinto" "SEC12" RFC 3028 does not specify whether &(fileinto)& should try to create a mail folder if it does not exist. This implementation allows the sysadmin to configure that aspect using the &(appendfile)& transport options @@ -338,7 +362,7 @@ configure that aspect using the &(appendfile)& transport options -.section "Semantics of redirect" +.section "Semantics of redirect" "SEC13" Sieve scripts are supposed to be interoperable between servers, so this implementation does not allow mail to be redirected to unqualified addresses, because the domain would depend on the system being used. On systems with @@ -347,7 +371,7 @@ it to be. -.section "String arguments" +.section "String arguments" "SEC14" There has been confusion if the string arguments to &(require)& are to be matched case-sensitively or not. This implementation matches them with the match type &(:is)& (default, see section 2.7.1 of the RFC) and the comparator @@ -357,7 +381,7 @@ the command defaults clearly, so any different implementations violate RFC -.section "Number units" +.section "Number units" "SEC15" There is a mistake in RFC 3028: the suffix G denotes gibi-, not tebibyte. The mistake is obvious, because RFC 3028 specifies G to denote 2^30 (which is gibi, not tebi), and that is what this implementation uses as @@ -365,7 +389,7 @@ the scaling factor for the suffix G. -.section "RFC compliance" +.section "RFC compliance" "SEC16" Exim requires the first line of a Sieve filter to be .code # Sieve filter @@ -430,7 +454,7 @@ are filed into &_inbox_& due to an error in the filter. This chapter contains a full description of the contents of Exim filter files. -.section "Format of Exim filter files" +.section "Format of Exim filter files" "SEC17" Apart from leading white space, the first text in an Exim filter file must be .code # Exim filter @@ -462,7 +486,7 @@ If the character # follows a separator anywhere in a command, everything from in a filter file. -.section "Data values in filter commands" +.section "Data values in filter commands" "SEC18" There are two ways in which a data value can be input: .ilist @@ -534,7 +558,7 @@ if $message_body contains \N$$$$\N then ... tests for a run of four dollar characters. -.section "Some useful general variables" +.section "Some useful general variables" "SEC19" A complete list of the available variables is given in the Exim documentation. This shortened list contains the ones that are most likely to be useful in personal filter files: @@ -666,7 +690,7 @@ substituted. Thus it is important to spell the names of headers correctly. Do not use &$header_Reply_to$& when you really mean &$header_Reply-to$&. -.section "User variables" +.section "User variables" "SEC20" There are ten user variables with names &$n0$& &-- &$n9$& that can be incremented by the &(add)& command (see section &<>&). These can be used for &"scoring"& messages in various ways. If Exim is configured to run a @@ -676,7 +700,7 @@ thus making them available to users' filter files. How these values are used is entirely up to the individual installation. -.section "Current directory" +.section "Current directory" "SEC21" The contents of your filter file should not make any assumptions about the current directory. It is best to use absolute paths for file names; you can normally make use of the &$home$& variable to refer to your home directory. The @@ -720,7 +744,7 @@ finish -.section "Filter commands" +.section "Filter commands" "SEC222" The filter commands that are described in subsequent sections are listed below, with the section in which they are described in brackets: @@ -824,12 +848,14 @@ message to be written to its argument file, provided they are different (duplicate &(save)& commands are ignored). If the file name does not start with a / character, the contents of the -&$home$& variable are prepended, unless it is empty. In conventional -configurations, this variable is normally set in a user filter to the user's -home directory, but the system administrator may set it to some other path. In -some configurations, &$home$& may be unset, in which case a non-absolute path -name may be generated. Such configurations convert this to an absolute path -when the delivery takes place. In a system filter, &$home$& is never set. +&$home$& variable are prepended, unless it is empty, or the system +administrator has disabled this feature. In conventional configurations, this +variable is normally set in a user filter to the user's home directory, but the +system administrator may set it to some other path. In some configurations, +&$home$& may be unset, or prepending may be disabled, in which case a +non-absolute path name may be generated. Such configurations convert this to an +absolute path when the delivery takes place. In a system filter, &$home$& is +never set. The user must of course have permission to write to the file, and the writing of the file takes place in a process that is running as the user, under the @@ -1014,7 +1040,6 @@ mail-sending command is &` [log `&<&'log file name'&>&`]`& &` [once `&<&'note file name'&>&`]`& &` [once_repeat `&<&'time interval'&>&`]`& - &`e.g. mail text "Your message about $h_subject: has been received"`& .endd Each <&'address-list'&> can contain a number of addresses, separated by commas, @@ -1251,7 +1276,7 @@ negative forms of condition that are more English-like. -.section "String testing conditions" +.section "String testing conditions" "SEC23" There are a number of conditions that operate on text strings, using the words &"begins"&, &"ends"&, &"is"&, &"contains"& and &"matches"&. If you want to apply the same test to more than one header line, you can easily concatenate @@ -1366,7 +1391,7 @@ available for use in subsequent sub-conditions, because string expansion of a condition occurs just before it is tested. -.section "Numeric testing conditions" +.section "Numeric testing conditions" "SEC24" The following conditions are available for performing numerical tests: .display @@ -1382,7 +1407,7 @@ followed by one of the letters K or M (upper case or lower case) which cause multiplication by 1024 and 1024x1024 respectively. -.section "Testing for significant deliveries" +.section "Testing for significant deliveries" "SEC25" You can use the &(delivered)& condition to test whether or not any previously obeyed filter commands have set up a significant delivery. For example: .code @@ -1393,7 +1418,7 @@ message has not actually been delivered; rather, a delivery has been set up for later processing. -.section "Testing for error messages" +.section "Testing for error messages" "SEC26" The condition &(error_message)& is true if the incoming message is a bounce (mail delivery error) message. Putting the command .code @@ -1405,7 +1430,7 @@ wrong in such a way that you cannot receive delivery error reports. &*Note*&: not preceded by &`$`&. -.section "Testing a list of addresses" +.section "Testing a list of addresses" "SEC27" There is a facility for looping through a list of addresses and applying a condition to each of them. It takes the form .display @@ -1497,7 +1522,7 @@ the tests. -.section "Alias addresses for the personal condition" +.section "Alias addresses for the personal condition" "SEC28" It is quite common for people who have mail accounts on a number of different systems to forward all their mail to one system, and in this case a check for personal mail should test all their various mail addresses. To allow for this, @@ -1515,7 +1540,7 @@ The alias addresses are treated as alternatives to the current user's email address when testing the contents of header lines. -.section "Details of the personal condition" +.section "Details of the personal condition" "SEC29" The basic &(personal)& test is roughly equivalent to the following: .code not error_message and @@ -1527,7 +1552,7 @@ $message_headers does not contain "\nList-Post:" and $message_headers does not contain "\nList-Owner:" and $message_headers does not contain "\nList-Archive:" and ( -"${if def h_auto-submitted:{present}{absent}}" is "absent" or +"${if def:h_auto-submitted:{present}{absent}}" is "absent" or $header_auto-submitted: is "no" ) and $header_precedence: does not contain "bulk" and @@ -1537,14 +1562,14 @@ foranyaddress $header_to: ( $thisaddress contains "$local_part$domain" ) and not foranyaddress $header_from: ( -$thisaddress contains "$local_partdomain" or -$thisaddress contains "server" or -$thisaddress contains "daemon" or -$thisaddress contains "root" or -$thisaddress contains "listserv" or -$thisaddress contains "majordomo" or -$thisaddress contains "-request" or -$thisaddress matches "^owner-[^]+" +$thisaddress contains "$local_part@$domain" or +$thisaddress contains "server@" or +$thisaddress contains "daemon@" or +$thisaddress contains "root@" or +$thisaddress contains "listserv@" or +$thisaddress contains "majordomo@" or +$thisaddress contains "-request@" or +$thisaddress matches "^owner-[^@]+@" ) .endd The variable &$local_part$& contains the local part of the mail address of @@ -1556,7 +1581,7 @@ the current user are also done with alternative addresses. -.section "Testing delivery status" +.section "Testing delivery status" "SEC30" There are two conditions that are intended mainly for use in system filter files, but which are available in users' filter files as well. The condition &(first_delivery)& is true if this is the first process that is attempting to @@ -1574,7 +1599,7 @@ some reason, and was subsequently released by the system administrator. It is unlikely to be of use in users' filter files. -.section "Multiple personal mailboxes" "SECTmbox" +.section "Multiple personal mailboxes" "SECTmbox" "SEC31" The system administrator can configure Exim so that users can set up variants on their email addresses and handle them separately. Consult your system administrator or local documentation to see if this facility is enabled on your @@ -1605,7 +1630,7 @@ suffixes in its checking. -.section "Ignoring delivery errors" +.section "Ignoring delivery errors" "SEC43" As was explained above, filtering just sets up addresses for delivery &-- no deliveries are actually done while a filter file is active. If any of the generated addresses subsequently suffers a delivery failure, an error message