Autor: Mattia Dongili Data: Dla: Andreas Metzler CC: exim-users Temat: Re: [Exim] exim4 on a mobile environment
On Wed, Oct 01, 2003 at 02:36:52PM +0200, Andreas Metzler wrote: > On Wed, Oct 01, 2003 at 01:42:52PM +0200, Mattia Dongili wrote:
> > I'm trying to configure exim4 (4.2.22 on debian) to use different
> > smarthosts based on different network environment, only 2 at the moment.
> >
> > The problem I encountered is I'm triyng to use conditionals to provide
> > the smarthost and port settings to exim.
> >
> > I defined the macros (tested and working with exim4 -be)
> >
> > DCsmarthost = ${if exists {/etc/exim4/work-env}{smtp.work.it}{smtp.home.it}}
> > MYport = ${if exists{/etc/exim4/work-env}{8025}{25}} [...] > > I'm clueless... I tried enclosing the 2 conditions between "" and not
> > using macros but the result doesn't change
>
> Using quotes seems to work for me for the router:
>
> balrog:/etc/exim4# grep ^DCsmarthost /var/lib/exim4/config.autogenerated
> DCsmarthost = "${if exists {/etc/exim4/work-env}{smtp.work.it}{server.logic.univie.ac.at}}"
ouch! you're right... It seems I didn't test it carefully enough... :P
> However "port" is not expanded, you'll have to copy your remote_smtp
> to remote_smtp_8025 and use an expansion in the router to choose
> remote_smtp or remote_smtp_8025.
thanks for the precious hint.
Anyway, is there any other, maybe cleaner, way to setup different
smarthosts for different network environments?
I'm thinking of creating different transports and routers files for each
environment and .include one or the other based on the execution of a
simple script that will find the correct environment (grepping
/etc/resolv.conf).