Exim on a dialup line and hand it off to a smarthost


These settings below will configure Exim on a dialup line to deliver mail immediately to the local domain (say linuxbox.example.com), queue all outbound mail when offline and hand it off to a smarthost for delivery. However, unqualified senders (say “user”) will be qualified as “user@example.com”

For exim 3.x In the Main Configuration Settings section

        primary_hostname = example.com
        qualify_domain = example.com
        qualify_recipient = example.com
        local_domains = linuxbox.example.com
        host_accept_relay = localhost 
        queue_remote_domains = ! localhost

In the Routers section [right at the top, before other routers]

                route_list="* your.isps.smtp.server byname"

For exim 4.x

        primary_hostname = example.com
        domainlist local_domains = lsearch:/usr/local/etc/exim/local_domains
        hostlist relay_from_hosts =
        queue_domains = ! *.localnet

In the Routers section [right at the top, before other routers]

        driver = manualroute
        domains = !+local_domains
        transport = remote_smtp
        route_list = * your.isps.smtp.server

This will force outgoing mail through your.isps.smtp.server when connected

To process the queued messages and deliver them to your smarthost, put this line in your /etc/ppp/ip-up.local file –

        /usr/exim/bin/exim -qff &

There you go …

Section 14 of the Exim FAQ will give you a few more nifty ideas on configuring exim for use over a dialup.

More and more ISPs require you to use SMTP AUTH to authenticate yourself before sending mail through their servers. So, you can set up exim as an AUTH client so that it authenticates itself to the smarthost before relaying through it.

For this, you need exim compiled with cyrus sasl and openssl libraries – most distro packaged exims are compiled with these anyway. If you want to compile exim by hand, just uncomment the necessary lines in Local/Makefile and go on with make, make install

Make sure your cyrus sasl is compiled with PLAIN and LOGIN support, if your ISP only offers AUTH PLAIN and LOGIN instead of other methods such as AUTH CRAM-MD5. If you are using an RPM (or other package) you might have to install a couple of additional packages which are plain / login plugins for sasl – for example, on redhat it would be cyrus-sasl-plain-[version].rpm and cyrus-sasl-login-[version].rpm. You can find out what authentication and other options (say TLS) your ISP offers by telneting to port 25 of their smtp server and issuing an EHLO command:

For example –

   srs@quirk:~$ telnet frodo.hserus.net 25
   220 frodo.hserus.net ESMTP NO UCE
   ehlo quirk.hserus.net
   250-frodo.hserus.net Hello quirk.hserus.net []
   250-SIZE 52428800
   250 HELP

Once you have seen that your ISP offers AUTH – stick the following into your exim configure file (configure, exim.conf or whatever you call it) –

In your remote_smtp transport:

     driver = smtp
     hosts_require_auth = authsmtp.example.com
     hosts_try_auth = authsmtp.example.com

At the bottom of your configure file, in the authenticators section:

      driver = plaintext
      public_name = LOGIN
      client_send = ": username : password"

See the exim FAQ for examples using AUTH PLAIN or AUTH CRAM-MD5