Using smarthosts with exim

Introduction

When using a laptop you might be connected to different networks with different environments. Therefore you have to setup your networking options properly to meet the requirements. There are a couple of tools that help to automate this task but I just wanted to know how I could rewrite only a small part of my exim configuration. While trying to find the most easiest way I also started a thread on the debian-laptop list to get an idea how other linux users handle their configuration. This page is the results of all ideas. The main question was:"How can I use a smarthost when connected to network A and no smarthost when connected to network B?"

The "indicating-file" method

This is the method that I prefer, because it is rather simple. Just write a new router in your configuration file(on debian it's /etc/exim/exim.conf).
smarthost:
  driver = domainlist
  transport = remote_smtp
  require_files = /etc/exim/smarthost
  route_list = "* smarthost.at byname"
Now exim only uses a smarthost when the file /etc/exim/smarthost is present. Otherwise the whole smarthost section is skipped.