Re: [exim] counting number of adresses in From

Top Page

Reply to this message
Author: Arkadiusz Miśkiewicz
Date:  
To: Todd Lyons
CC: exim-users
Old-Topics: Re: [exim] counting number of adresses in From
Subject: Re: [exim] counting number of adresses in From
On Tuesday 06 of September 2011, Todd Lyons wrote:
> On Tue, Sep 6, 2011 at 1:11 AM, Arkadiusz Miskiewicz <arekm@???> wrote:
> > exim doesn't have any builtin way to count number of elements.
>
> Yeah, would be nice. For your particular query, there is a recipient
> count, but not a sender count, which is what you want.
>
> > Looking for something like:
> > deny message = you are bad
> > condition = ${if count(${addresslist:$h_From:}) > 1}
>
> This works for me:
>   # DEBUG #
>   warn    set acl_m_sender_count = ${reduce \
>                            {>, ${addresses:$h_from:} } \
>                            { 0 } \
>                            {${eval:$value+1}} \
>                           }
>             logwrite       = Found $acl_m_sender_count senders in From
> header


$h_from failed on something, so now using $rh_from and that works well but
there are emails like this:

Date: Wed, 4 Apr 2012 08:14:35 -0500
From: <some@???>,
<someother@???>
User-Agent: Mozilla/5.0

and unfortunately rh_from doesn't contain both addresses - only first one
like:

"<some@???>,\n"

"The newline that terminates a header line is not included in the expansion,
but internal newlines (caused by splitting the header line over several
physical lines) may be present."

So IMO both lines should be there in $rh_from, right?

-- 
Arkadiusz Miśkiewicz        PLD/Linux Team
arekm / maven.pl            http://ftp.pld-linux.org/