Re: [Exim] exim4 on a mobile environment

Góra strony
Delete this message
Reply to this message
Autor: Andreas Metzler
Data:  
Dla: exim-users
CC: Mattia Dongili
Temat: Re: [Exim] exim4 on a mobile environment
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}}
>
> and
>
> remote_smtp:
> debug_print = "T: remote_smtp for $local_part@$domain"
> driver = smtp
> port = MYport
>
> and
>
> smarthost:
> driver = manualroute
> domains = ! +local_domains
> transport = remote_smtp
> route_list = * DCsmarthost
>
> host_find_failed = defer
> same_domain_copy_routing = yes
> no_more

[...]
> LOG: queue_run MAIN
> Start queue run: pid=1709 -qf
> LOG: MAIN
> == m.dongili@??? R=smarthost defer (-1): smarthost router: failed to expand "${if": condition name expected, but found ""
> LOG: queue_run MAIN
> End queue run: pid=1709 -qf
>
> or
>
> LOG: queue_run MAIN
> Start queue run: pid=1861 -qf
> T: remote_smtp for m.dongili@???
> LOG: MAIN PANIC
> == m.dongili@??? R=smarthost T=remote_smtp defer (-1): TCP port "${if exists{/etc/exim4/work-env}{8025}{25}}" is not defined for remote_smtp transport
> LOG: queue_run MAIN

[...]
> 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}}"

balrog:/etc/exim4# touch /etc/exim4/work-env
balrog:/etc/exim4# exim4 -bt ametzler
R: system_aliases for ametzler@???
R: hub_user for ametzler@???
ametzler@???
    <-- ametzler@???
  router = smarthost, transport = remote_smtp
  host host50.work.it [151.4.107.50]
balrog:/etc/exim4# rm /etc/exim4/work-env
balrog:/etc/exim4# exim4 -bt ametzler
R: system_aliases for ametzler@???
R: hub_user for ametzler@???
ametzler@???
    <-- ametzler@???
  router = smarthost, transport = remote_smtp
  host server.logic.univie.ac.at [131.130.190.41]


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.
             cu andreas