On Wed, Jun 26, 2013 at 10:13 AM, soumya tr <[email protected]> wrote:
> Hi,
>
> Is it possible to extract the last field using extract in exim?
> Suppose the input is:
> "[email protected]" <[email protected]>
>
> I need to extract the last field when delimiter is '@'.
> Using ${extract {3}{@}{"[email protected]" <[email protected]>}}, I can obtain jkl.com>
> . But i needed a generic solution. As incase there are >3 @ , then the
> obtained output will not be the expected one. How can I achieve this?
Phil Pennock provided a fantastic solution to that a while back:
To get the last:
${reduce{${addresses:$h_from:}}{}{$item}}
To get the first:
${reduce{${addresses:$h_from:}}{}{${if eq{$value}{}{$item}{$value}}}}
http://www.exim.org/lurker/message/20110310.173811.9608d368.en.html
...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine
--
## List details at https://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/