[Pkg-exim4-users] Configuring smarthost based on the network

Marc Haber mh+pkg-exim4-users at zugschlus.de
Mon Aug 10 10:38:20 UTC 2009


On Mon, Aug 10, 2009 at 02:21:55AM +0200, Norbert Preining wrote:
> Unfortunately sometimes the port 25 is blocked (even outgoing) in some
> networks and smtp sending can *only* be done via their mail router.
> 
> Now, is there a solution to the changing smart host problem?
> 
> Best would be a solution that incorporates with e.g. wicd (which I am
> using), or NetworkManager (which I never touched), and of course with
> /etc/network/interfaces.

If you have an /etc/network/interface entry per network, you just add
an "exim4-smarthost" setting in the stanza and use this
/etc/network/if-up.d/exim4-smarthost:

#!/bin/bash

# Environment:
#  MODE = { start | stop }
#  IF_EXIM4_SMARTHOST = hostname port

SMARTHOSTFILE="/etc/exim4/conf.d/main/00_local_DCsmarthost"

if [ -z "$IF_EXIM4_SMARTHOST" ]; then
  exit 0
fi

if [ "$MODE" = 'stop' ]; then
  rm -f $SMARTHOSTFILE
  /etc/init.d/exim4 reload > /dev/null || true
  exit 0
fi

if [ "$IF_EXIM4_SMARTHOST" = "none" ]; then
  rm -f $SMARTHOSTFILE
  /etc/init.d/exim4 reload > /dev/null || true
  exit 0
fi

echo "DCsmarthost = ${IF_EXIM4_SMARTHOST}" > $SMARTHOSTFILE

/etc/init.d/exim4 reload > /dev/null || true
/usr/sbin/exim4 -qqf


This works only with split config.

I didn't find any Networkmanager docs which would allow me to
understand it, so I do not have a solution for this.

Greetings
Marc

-- 
-----------------------------------------------------------------------------
Marc Haber         | "I don't trust Computers. They | Mailadresse im Header
Mannheim, Germany  |  lose things."    Winona Ryder | Fon: *49 621 72739834
Nordisch by Nature |  How to make an American Quilt | Fax: *49 3221 2323190



More information about the Pkg-exim4-users mailing list