Nullmailer

  1. Choose a local domain to be used
    e.g. cave.local

  2. Add the local server to the desired smarthosts dns or hosts file:
    e.g. server.cave.local

  3. Set the mailname of the local server to the same name (hostname can be whatever you want)
    # /etc/mailname
    server.cave.local
  4. Set the forward- or targetaddress for any mail
    # /etc/nullmailer/adminaddr
    somebody@germany.de
  5. Set the local default domain to the domain from step 1
    # /etc/nullmailer/defaultdomain
    cave.local
  6. Edit delivery target, user and password (connection can be secured by using the vpn or add –ssl and import the needed certificates)
    # /etc/nullmailer/remotes
    target.server.at.vpn smtp --user=name@cave.local --pass=<password> [--ssl [--insecure]]
  7. Stop nullmailer use testmail.sh and nullmailer-send to debug.

/sbin/testmail.sh

#! /bin/bash
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

cat <<EOF | sendmail root
Subject: Testmail

Server $(hostname -f)
DateTime $(date)
.
EOF