Re: [exim] Exim + filter + mkdir

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Phil Pennock
Dátum:  
Címzett: Andrey Morskoy
CC: exim-users
Tárgy: Re: [exim] Exim + filter + mkdir
On 2008-03-16 at 13:18 +0200, Andrey Morskoy wrote:
> I have made setup of system filter for exim:
> unseen save /home/mailstore/mail/$reply_address+$tod_log+$message_exim_id
>
> Everything works fine, but now I want to store mail this way:
> /home/mailstore/mail/Mar/$reply_address+$tod_log+$message_exim_id
> /home/mailstore/mail/May/$reply_address+$tod_log+$message_exim_id
> ...
> /home/mailstore/mail/Dec/$reply_address+$tod_log+$message_exim_id
>
> I do not want to change Exim's config every month, as well, as I do not
> want to have a set of empty dirs, created for further months...
>
> Can exim calculate current Month?
> I suppose, that I need to make regex for $tod_log - I think can, but how
> does it looks in Exim?


The Subject: says mkdir, so I'll cover that easy bit first: in the
appendfile transport which is specified by
"system_filter_file_transport", set "create_directory" (and perhaps
"directory_mode"), so that parent directories will be created for you.

The easiest way to get the month into the system filter is probably to
set an ACL variable during message reception and then refer to it in the
filter file. I _think_ the ACL variables are visible to the system
filter (but I've never checked it).

So:
warn set acl_c_month = ${extract{2}{ }{$tod_bsdinbox}}

and then just use $acl_c_month in the system filter.

Otherwise, you have to do some kind of dummy comparison against the date
and then use $1 to get the extracted field.

-Phil