Added expansion items addresses, filter, map, reduce.
[exim.git] / doc / doc-txt / NewStuff
index 3fe06394fca04c8f11160cef17adebc33b3547c1..b70fa5e68bc50f321ecc1fab11fb1d7f758def15 100644 (file)
@@ -1,4 +1,4 @@
-$Cambridge: exim/doc/doc-txt/NewStuff,v 1.130 2007/01/23 14:34:02 ph10 Exp $
+$Cambridge: exim/doc/doc-txt/NewStuff,v 1.141 2007/02/14 14:59:01 ph10 Exp $
 
 New Features in Exim
 --------------------
@@ -197,6 +197,174 @@ Version 4.67
     go while a single connection is being processed. When a child process
     terminates, the daemon decrements the variable.
 
+ 6. There's a new control called no_pipelining, which does what its name
+    suggests. It turns off the advertising of the PIPELINING extension to SMTP.
+    To be useful, this control must be obeyed before Exim sends its response to
+    an EHLO command. Therefore, it should normally appear in an ACL controlled
+    by acl_smtp_connect or acl_smtp_helo.
+
+ 7. There are two new variables called $sending_ip_address and $sending_port.
+    These are set whenever an SMTP connection to another host has been set up,
+    and they contain the IP address and port of the local interface that is
+    being used. They are of interest only on hosts that have more than on IP
+    address that want to take on different personalities depending on which one
+    is being used.
+
+ 8. The expansion of the helo_data option in the smtp transport now happens
+    after the connection to the server has been made. This means that it can
+    use the value of $sending_ip_address (see 7 above) to vary the text of the
+    message. For example, if you want the string that is used for helo_data to
+    be obtained by a DNS lookup of the interface address, you could use this:
+
+      helo_data = ${lookup dnsdb{ptr=$sending_ip_address}{$value}\
+        {$primary_hostname}}
+
+    The use of helo_data applies both to sending messages and when doing
+    callouts.
+
+ 9. There is a new expansion operator ${rfc2047d: that decodes strings that
+    are encoded as per RFC 2047. Binary zero bytes are replaced by question
+    marks. Characters are converted into the character set defined by
+    headers_charset. Overlong RFC 2047 "words" are not recognized unless
+    check_rfc2047_length is set false.
+
+10. There is a new log selector called "pid", which causes the current process
+    id to be added to every log line, in square brackets, immediately after the
+    time and date.
+
+11. Exim has been modified so that it flushes SMTP output before implementing
+    a delay in an ACL. It also flushes the output before performing a callout,
+    as this can take a substantial time. These behaviours can be disabled by
+    obeying control = no_delay_flush or control = no_callout_flush,
+    respectively, at some earlier stage of the connection. The effect of the
+    new default behaviour is to disable the PIPELINING optimization in these
+    situations, in order to avoid unexpected timeouts in clients.
+
+12. There are two new expansion conditions that iterate over a list. They are
+    called forany and forall, and they are used like this:
+
+      ${if forany{<a list>}{<a condition>}{<yes-string>}{<no-string>}}
+      ${if forall{<a list>}{<a condition>}{<yes-string>}{<no-string>}}
+
+    The first argument is expanded, and the result is treated as a list. By
+    default, the list separator is a colon, but it can be changed by the normal
+    method. The second argument is interpreted as a condition that is to be
+    applied to each item in the list in turn. During the interpretation of the
+    condition, the current list item is placed in a variable called $item.
+
+    - For forany, interpretation stops if the condition is true for any item,
+      and the yes-string is then expanded. If the condition is false for all
+      items in the list, the no-string is expanded.
+
+    - For forall, interpration stops if the condition is false for any item,
+      and the no-string is then expanded. If the condition is true for all
+      items in the list, the yes-string is expanded.
+
+    Note that negation of forany means that the condition must be false for all
+    items for the overall condition to succeed, and negation of forall means
+    that the condition must be false for at least one item.
+
+    In this example, the list separator is changed to a comma:
+
+      ${if forany{<, $recipients}{match{$item}{^user3@}}{yes}{no}}
+
+    Outside a forany/forall condition, the value of $item is an empty string.
+    Its value is saved and restored while forany/forall is being processed, to
+    enable these expansion items to be nested.
+
+13. There's a new global option called dsn_from that can be used to vary the
+    contents of From: lines in bounces and other automatically generated
+    messages ("delivery status notifications" - hence the name of the option).
+    The default setting is:
+
+      dsn_from = Mail Delivery System <Mailer-Daemon@$qualify_domain>
+
+    The value is expanded every time it is needed. If the expansion fails, a
+    panic is logged, and the default setting is used.
+
+14. The smtp transport has a new option called hosts_avoid_pipelining. It can
+    be used to suppress the use of PIPELINING to certain hosts, while still
+    supporting the other SMTP extensions (cf hosts_avoid_tls).
+
+15. By default, exigrep does case-insensitive matches. There is now a -I option
+    that makes it case-sensitive. This may give a performance improvement when
+    searching large log files. Without -I, the Perl pattern matches use the /i
+    option; with -I they don't. In both cases it is possible to change the case
+    sensitivity within the pattern using (?i) or (?-i).
+
+14. A number of new features have been added to string expansions to make it
+    easier to process lists of items, typically addresses. These are as
+    follows:
+
+  * ${addresses:<string>}
+
+    The string (after expansion) is interpreted as a list of addresses in RFC
+    2822 format, such as can be found in a To: or Cc: header line. The
+    operative address (local-part@domain) is extracted from each item, and the
+    result of the expansion is a colon-separated list, with appropriate
+    doubling of colons should any happen to be present in the email addresses.
+    Syntactically invalid RFC2822 address items are omitted from the output.
+
+    It is possible to specify a character other than colon for the output
+    separator by starting the string with > followed by the new separator
+    character. For example:
+
+      ${addresses:>& The Boss <ceo@up.stairs>, sec@base.ment (dogsbody)}
+
+    expands to "ceo@up.stairs&sec@base.ment". Compare ${address (singular),
+    which extracts the working address from a single RFC2822 address.
+
+  * ${map{<string1>}{<string2>}}
+
+    After expansion, <string1> is interpreted as a list, colon-separated by
+    default, but the separator can be changed in the usual way. For each item
+    in this list, its value is place in $item, and then <string2> is expanded
+    and added to the output as an item in a new list. The separator used for
+    the output list is the same as the one used for the input, but is not
+    included in the output. For example:
+
+      ${map{a:b:c}{[$item]}} ${map{<- x-y-z}{($item)}}
+
+    expands to "[a]:[b]:[c] (x)-(y)-(z)". At the end of the expansion, the
+    value of $item is restored to what it was before.
+
+  * ${filter{<string1>}{<condition>}}
+
+    After expansion, <string1> is interpreted as a list, colon-separated by
+    default, but the separator can be changed in the usual way. For each item
+    in this list, its value is place in $item, and then the condition is
+    evaluated. If the condition is true, $item is added to the output as an
+    item in a new list; if the condition is false, the item is discarded. The
+    separator used for the output list is the same as the one used for the
+    input, but is not included in the output. For example:
+
+      ${filter{a:b:c}{!eq{$item}{b}}
+
+    yields "a:c". At the end of the expansion, the value of $item is restored
+    to what it was before.
+
+  * ${reduce{<string1>}{<string2>}{<string3>}}
+
+    The ${reduce expansion operation reduces a list to a single, scalar string.
+    After expansion, <string1> is interpreted as a list, colon-separated by
+    default, but the separator can be changed in the usual way. Then <string2>
+    is expanded and assigned to the $value variable. After this, each item in
+    the <string1> list is assigned to $item in turn, and <string3> is expanded
+    for each of them. The result of that expansion is assigned to $value before
+    the next iteration. When the end of the list is reached, the final value of
+    $value is added to the expansion string. The ${reduce expansion item can be
+    used in a number of ways. For example, to add up a list of numbers:
+
+      ${reduce {<, 1,2,3}{0}{${eval:$value+$item}}}
+
+    The result of that expansion would be "6". The maximum of a list of numbers
+    can be found:
+
+      ${reduce {3:0:9:4:6}{0}{${if >{$item}{$value}{$item}{$value}}}}
+
+    At the end of a ${reduce expansion, the values of $item and $value is
+    restored to what they were before.
+
 
 Version 4.66
 ------------