Re: [exim] Block emails with date in future

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Ian Eiloart
Date:  
À: Chris Laif
CC: <exim-users@exim.org>
Sujet: Re: [exim] Block emails with date in future

On 17 Jun 2011, at 14:27, Chris Laif wrote:

> On Fri, Jun 17, 2011 at 2:12 PM, Dave Lugo <dlugo@???> wrote:
>>> is there a way to block emails with a date in future ($h_date >
>>> now()+'1 day') within the check_data acl?
>>>
>>> Regards,
>>> Chris
>>>
>>
>> Not exactly the answer you're looking for, but if you use
>> spamassassin (which can be called from the data acl), one
>> of its tests is for a date in the future.
>>
>
> Dave, thanks for your answer. I'm looking for a lightweight solution
> without any external components (no perl. no executeables ...).
>
> Chris


There aren't any build in date operators, so it's going to be pretty complicated in exim, you'll need to extract the hd/hm/hy from $h_date: and d/m/y from $tod_full

for example, $hd = ${extract{2}{' '}{$h_date}

and then construct a rule like:

where y/m/d is todays date, and hy/hm/hd is the header date

hy > y unless hy = y + 1 and hd-hm-d-m = 1-1-31-12
or hy = y and hm > m unless ( hm = m + 1 and hd = 1 and ((m = 2 and d>27) or (d>29)))
or hy = y and hm = m and hd > d+1

you're going to need $eval to do the additions, I think.

I'm not sure how you obtain a numeric value for the month: you may need a series of conditional assignments.

--
Ian Eiloart
Postmaster, University of Sussex
+44 (0) 1273 87-3148