How do I add outbound only mail service for local tools to a 'minimal' debian system?

Solution 1:

Similar to this answer, but I prefer to set exim to use a smarthost and have no local mail when the box isn't actually acting as a mail server.

  • apt-get install exim4
  • Run dpkg-reconfigure exim4-config
    • Yes, split the configs
    • verify the system name is correct
    • The listen address should be '127.0.0.1'
    • Other destinations should be the systems fqdn
    • Domains to relay for should be left empty
    • Machines to relay for should be left empty
    • smarthost should be the hostname of your smtp server
  • Update the /etc/aliases and point root at the email address I want service messages to be delievered too.

Solution 2:

You want ssmtp, a super simple, really trivial to configure outbound mail relay. It's also very tiny, so suitable for embedded systems.

Solution 3:

Such a configuration is called a 'nullclient' configuration. Some guides are available:

  • Postfix: http://www.postfix.org/STANDARD_CONFIGURATION_README.html#null_client
  • Sendmail: http://www.sendmail.org/m4/features.html

For sendmail, all you should need it:

FEATURE(`nullclient', `mailhub.domain.notused')dnl

Some distros (openSuSE) provide a separate 'nullclient.mc' configuration file for this purpose.

Solution 4:

You have several choices for send-only mailers. ssmtp was already mentioned, but msmtp and nbsmtp will also get the job done.