Re: system filters and pipe

Top Page
Delete this message
Reply to this message
Author: Roger Books
Date:  
To: exim-users
Subject: Re: system filters and pipe
> On Fri, 10 Jan 1997, Roger Books wrote:
>
> > In order to correct this problem I'd like to have a system filter that
> > filters things for local delivery, stripping out whoever is in the
> > To: line and replacing it with ${local_part}@???, not
> > exactly standard but it would correct my problem and save me a ton of
> > phone calls.
> > To that end I made the following changes:
>
> > # This director handles a systemwide filter
> > system_filter:
> > no_verify,
> > driver=forwardfile;
> > no_check_local_user,
> > filter,
> > file = /etc/system-mail-filter,
> > user = nobody
>
> That will obey the filter file for *every* message; I take it that is
> what you want.


Actually, I just want to filter messages for local delivery, can I set
this up in my config file for exim?

>
> > # Exim filter
> > save /tmp/system-mail-filter.out
> > if ${domain} is mail.dms.state.fl.us or
> >     ${domain} is mail.dms.state.fl.us or
> >     ${domain} is rtssec1.dms.state.fl.us 
> > then
> >     pipe "/usr/local/bin/remove_to_line ${local_part}@???"
> > endif

>
> That will save a copy of all messages in /tmp/system-mail-filter.out,
> and pass some to your script. Ah! Perhaps that's your problem. Should
> that really be "unseen save"? Messages that are to domains other than
> those you test for will just get saved there and not passed on to
> anything else.


Hmm, there is one thing to correct. The save was more for debugging
than any real need for a log. I'll change that to unseen save.

>
> > Then I wrote the following tcl script.
>
> I don't know tcl, but the script doesn't seem to be resubmitting the
> message anywhere... Have I missed where it is directing the output back
> to Exim?


The script writes back to standard out. I had assumed (probably
erroneously) that when exim executed a filter it wrote the filter recieved
the message on stdin and gave the message back to exim on stdout. Is this
not the case? I didn't want to invoke exim again as I was a bit afraid
of an endless loop. I also didn't want to invoke the local delivery agent
directly as I have exim looking for an overquota error to bounce the
mail message.

Thanks for the help. This looks like a great mail package so far. Once
I get over my blind spot as far as filters go that will be a very powerful
tool.

Roger