Mailing List Archive

saving to relative paths in filters for virtual users
Hi,

i used exim 3.x with xams, and some weeks ago i moved to 4.x and i'm
impressed, but there is one thing that i don't liked. In exim3.x we
could set the users home_directory with a trick, so it was possible to
use something like

save .Exim/

in your filterfile, and the mail was saved to a directory under the
"virtual-home-directory" of our user. This trick does not work anymore
for exim4, and i switched to use full-paths instead (but i don't liked it).

Some days ago i read a thread about someone who had the same problems
than me, and so i thought, there must be a way to fix it, and there is one.

My pmail_forward router now looks like this:

pmail_forward:
driver = redirect
allow_filter
check_ancestor
no_check_local_user
no_expn
require_files = "USERHOME/$local_part.filt"
data = ${sg {${readfile{USERHOME/$local_part.filt}}} \
{save\\s+([^/].*)\\s*}{save USERHOME/$local_part/\$1\\n}}
file_transport = pmail_delivery
pipe_transport = address_pipe
reply_transport = address_reply
directory_transport = pmail_delivery
retry_use_local_part
user = mail
no_verify

USERHOME is a macro that looks up the "home directory" of our virtual user,
My one:

USERHOME = /var/imap/${lookup mysql{SELECT s.Name FROM pm_domains d,
pm_sites s, pm_users u WHERE s.ID = d.SiteID AND d
.Name = '$domain' and u.Name = '$local_part' and u.SiteID = s.ID AND
s.SiteState != 'locked_bounce' AND u.AccountState
!= 'locked_bounce'}{${value}}}/

The trick is, we read the whole filterfile, and "preprocess", by using
${sg} we search for save (RELATIVE-PATH) and replace it with save
USERHOME/RELATIVE-PATH

This one works for me, i would be glad if someone with the same problem
could test this solution and give some response.

ciao
Nico

P.S. Thanks to PH for this GREAT MTA, IMHO it's the most powerful one i
ever used, and it makes most impossible things possible.
Re: saving to relative paths in filters for virtual users [ In reply to ]
On Thu, 4 Jul 2002, Nico Erfurth wrote:

> The trick is, we read the whole filterfile, and "preprocess", by using
> ${sg} we search for save (RELATIVE-PATH) and replace it with save
> USERHOME/RELATIVE-PATH

Clever! I do have a Wish List item to make it possible to specify "home
directories" for filter files, so one day you may not need this.

> P.S. Thanks to PH for this GREAT MTA, IMHO it's the most powerful one i
> ever used, and it makes most impossible things possible.

Thank you.

Philip

--
Philip Hazel University of Cambridge Computing Service,
ph10@cus.cam.ac.uk Cambridge, England. Phone: +44 1223 334714.
Re: saving to relative paths in filters for virtual users [ In reply to ]
Philip Hazel wrote:
> On Thu, 4 Jul 2002, Nico Erfurth wrote:
>
>
>>The trick is, we read the whole filterfile, and "preprocess", by using
>>${sg} we search for save (RELATIVE-PATH) and replace it with save
>>USERHOME/RELATIVE-PATH
>
> Clever! I do have a Wish List item to make it possible to specify "home
> directories" for filter files, so one day you may not need this.

This would be a better way, because i think exim is often used in
"virtual mail enviroments", and it's higly configureable in this situations.

But at least the power of exim, allowed me to "fix" the problem without
patching the MTA, and that is a great thing. ;)

ciao
Re: saving to relative paths in filters for virtual users [ In reply to ]
Philip Hazel wrote:
> On Thu, 4 Jul 2002, Nico Erfurth wrote:
>
>
>>The trick is, we read the whole filterfile, and "preprocess", by using
>>${sg} we search for save (RELATIVE-PATH) and replace it with save
>>USERHOME/RELATIVE-PATH
>
> Clever! I do have a Wish List item to make it possible to specify "home
> directories" for filter files, so one day you may not need this.

This would be a better way, because i think exim is often used in
"virtual mail enviroments", and it's higly configureable in this situations.

But at least the power of exim, allowed me to "fix" the problem without
patching the MTA, and that is a great thing. ;)

ciao

(This mail was resend, because the last one had a wrong sender-address.)