On 2011-03-10 at 10:43 -0500, Dean Brooks wrote: > On Thu, Mar 10, 2011 at 03:53:08PM +0100, Uros Meglic wrote: > > if I got this right the $header_from expand into "Username < > > usern...@domain.com>". Is this right? Now how could get just < > > usern...@domain.com> out of this $header_from? > > The expansion of ${address:$h_from:} will give you what you are > looking for. If you want it in all lower-case, you could even do > ${lc:${address:$h_from:}} > > Now, this assumes that there is only a single address in the From: > header, which is 99.9% of the time. Haven't tested it on what > happens with multiple addresses in the header.
You get nothing. To get the last: ${reduce{${addresses:$h_from:}}{}{$item}} To get the first: ${reduce{${addresses:$h_from:}}{}{${if eq{$value}{}{$item}{$value}}}} Alternatively, you can choose to reject messages with multiple addresses in From: in your DATA ACL; you'll be rejecting messages that are technically well-formed, but it's your system and you get to choose what you accept (unless you have contracts with customers saying otherwise). The easy way to test these things: $ cat <<EOM > test.eml From: Phil Pennock <p...@example.com>, Snert <sn...@example.com> To: Philip <phi...@example.org> Subject: Hey ho Date: nowish foo EOM $ exim -bem test.eml > ${address:$h_to:} phi...@example.org > ${address:$h_from:} > ${addresses:$h_from:} p...@example.com:sn...@example.com > ${reduce{${addresses:$h_from:}}{}{$item}} sn...@example.com > ${reduce{${addresses:$h_from:}}{}{${if eq{$value}{}{$item}{$value}}}} p...@example.com -- ## List details at http://lists.exim.org/mailman/listinfo/exim-users ## Exim details at http://www.exim.org/ ## Please use the Wiki with this list - http://wiki.exim.org/