Szerző: Todd Lyons Dátum: Címzett: Steven Reisman CC: exim-dev Tárgy: Re: [exim-dev] [Bug 1147] New: builtin list counting feature
On Tue, Sep 6, 2011 at 1:26 PM, Steven Reisman <sar@???> wrote: >> and I've tried to make a condition like "if count(addresses($h_from)) > 1"
>> exim-users people came up with this ugly (but working) hack:
>> # 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
>> This feature request is about adding some smart "count" expansion that would
>> allow to count members in lists.
> How about:
> ${eval:${strlen:${sg{item1, item2 ,item3, item4}{[^,]*}{}}}+1}
As long as ${addresses:$h_from:} is used, which strips all
descriptions from the email addresses, leaving just the email address
itself, that should work just as well. I came up with the above with
a quick google that found it on a debian admin site. The only thing I
did was break it from one long line into digestible chunks. :-)
I too think that a ${count: ... } function could prove to be extremely
useful. The code already exists which performs a $senders_count. It
just needs to be isolated and made into a simple to access function.
Having said that, I looked at it and was going to try to do it myself,
but the complexity was a bit more than I bargained for, so it proved
to be beyond my skillset.
...Todd
--
If Americans could eliminate sugary beverages, potatoes, white bread,
pasta, white rice and sugary snacks, we would wipe out almost all the
problems we have with weight and diabetes and other metabolic
diseases. -- Dr. Walter Willett, Harvard School of Public Health