Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: users

Conditional transport_filter

 

 

exim users RSS feed   Index | Next | Previous | View Threaded


exim-users at lists

Jul 20, 2013, 1:49 AM

Post #1 of 4 (70 views)
Permalink
Conditional transport_filter

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

I want a transport_filter to execute under certain conditions only. I
attempted making it so that if the condition didn't succeed then it
expanded to an empty string, but that didn't work. E.g:

transport_filter = "${if CONDITION{command to filter though}{}}"

One solution would be to just set up two separate transports that are
identical apart from one having the transport_filter, and then
reconfigure my routers to do the conditional check and choose the
appropriate transport accordingly. That way seems fairly messy though
as the transport in question is quite large.

Is there a good solution for this?

- --
Mike Cardwell https://grepular.com/ http://cardwellit.com/
OpenPGP Key 35BC AF1D 3AA2 1F84 3DC3 B0CF 70A5 F512 0018 461F
XMPP OTR Key 8924 B06A 7917 AAF3 DBB1 BF1B 295C 3C78 3EF1 46B4
-----BEGIN PGP SIGNATURE-----

iQGGBAEBCgBwBQJR6k82MBSAAAAAACAAB3ByZWZlcnJlZC1lbWFpbC1lbmNvZGlu
Z0BwZ3AuY29tcGdwbWltZTgUgAAAAAAVABpwa2EtYWRkcmVzc0BnbnVwZy5vcmdt
aWtlLmNhcmR3ZWxsQGdyZXB1bGFyLmNvbQAKCRCdJiMBwdHnBHiMB/0XZ6HkGJXs
jYQ8bziuoAXaxfvvRnmTbavwkrvQzWTL8YAkHyTHqqnU65Zk+aFHMBfoSf1sA1QP
SMl+oKLVOZGB1jw5GJKilWqUojDlddIVtTxWlnKXPzr6ckba0TVZYxXV3MtC5LGG
Zm4R/TsZLFTCOQI6oTlyCaEsUBQsFDe19gmxJCl5fCmluS0BNi4H/YWRQmaz0GLY
jzYXRuNY2Q9Gh7Be3+VHu7EV8kl0sGhFxzKJD7RWE26rBByyuxKIkckh6c5TWg5B
QQcCNlJSTmfIMvU88PgP2Syjhj9+qG7nm8vXt1fj6PhzWGsWTGMaeUyhYNE2/A+W
20Hm5KcSX1uf
=jcNy
-----END PGP SIGNATURE-----

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


jgh at wizmail

Jul 20, 2013, 7:59 AM

Post #2 of 4 (62 views)
Permalink
Re: Conditional transport_filter [In reply to]

On 07/20/2013 09:49 AM, Mike Cardwell wrote:
> I want a transport_filter to execute under certain conditions only. I
> attempted making it so that if the condition didn't succeed then it
> expanded to an empty string, but that didn't work. E.g:
>
> transport_filter = "${if CONDITION{command to filter though}{}}"

This won't work because the split-by-whitespace is done before expansions...

> Is there a good solution for this?

Could you pass the condition to the filter and have it decide to do nothing?
--
Cheers,
Jeremy


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


john.horne at plymouth

Jul 20, 2013, 9:12 AM

Post #3 of 4 (62 views)
Permalink
Re: Conditional transport_filter [In reply to]

On Sat, 2013-07-20 at 15:59 +0100, Jeremy Harris wrote:
> On 07/20/2013 09:49 AM, Mike Cardwell wrote:
> > I want a transport_filter to execute under certain conditions only. I
> > attempted making it so that if the condition didn't succeed then it
> > expanded to an empty string, but that didn't work. E.g:
> >
> > transport_filter = "${if CONDITION{command to filter though}{}}"
>
> This won't work because the split-by-whitespace is done before expansions...
>
> > Is there a good solution for this?
>
> Could you pass the condition to the filter and have it decide to do nothing?
>
Since the transport_filter expects output, the 'do nothing' could be the
'cat' command to just echo the incoming message. In that case though,
perhaps changing the '{}' in the above condition to '{cat}' would work?




John.

--
John Horne, Plymouth University, UK
Tel: +44 (0)1752 587287 Fax: +44 (0)1752 587001


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/


jasen at xnet

Jul 23, 2013, 4:39 AM

Post #4 of 4 (52 views)
Permalink
Re: Conditional transport_filter [In reply to]

On 2013-07-20, Mike Cardwell <exim-users [at] lists> wrote:
>
> I want a transport_filter to execute under certain conditions only. I
> attempted making it so that if the condition didn't succeed then it
> expanded to an empty string, but that didn't work. E.g:
>
> transport_filter = "${if CONDITION{command to filter though}{}}"

expand it to "cat" if you want a filter that makes no changes.

--
⚂⚃ 100% natural

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/

exim users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.