Simple Setup
============

You want
--------

- submit mail on stdin by calling masqmail on the commandline
- submit mail with SMTP from the local machine
- let masqmail deliver mail locally to the system mailboxes /var/mail/*
- let masqmail forward non-local mail through a smart host

This is like the simple-local-setup plus the forwarding.
Only the differences are described here.


Configuration
-------------

You need a config file like this one:

    host_name = "foo.example.org"
    permanent_routes = /etc/masqmail/default.route

(Substitute a real hostname, of course.)

Additionally you need to create the config file default.route.
You can derive it from the shipped example.route file.

If the route is not permanently available, you need to make it a
query route:

    query_routes.default = /etc/masqmail/default.route
    online_query = /etc/masqmail/query_script

The query script shall print the name of the preferred currently online
route. It can dump a file maintained by ip-up/-down scripts, or it can
use for example netstat. To query the availability of a port forward,
you can use:

    #! /bin/sh
    netstat -l -n -4 | fgrep -q ' 127.0.0.1:50025 ' && echo default

To query the availability of an interface, you could do something
similar using the netstat -i option.

Automatic queue runs
--------------------

Offline query routes and other temporary delivery errors cause messages
to be deferred. To ensure that they are delivered at a later point,
regular queue runs must be scheduled. This can be done either with the
-q<interval> option or externally via a cron job.

In addition to periodic queue runs, you can also trigger a queue run
each time a route comes online. To achieve that, put a script containing

    /usr/local/sbin/masqmail -qo default &

into a directory matching your network setup, for example
/etc/network/ip-up.d or /etc/ppp/ip-up.d/.


In case of problems
-------------------

Like in simple-local-setup plus ...

If you use a wrapper, test it manually and interactively on the
command line.
