Debian – How to add outbound only mail service for local tools to a ‘minimal’ debian system

debianemail-serversmtp

I have several servers running applications on debian. Each has the packages it requires for the application, and no more.

Currently, none have mail sending capability. However, I would like the output of tools like cron to be mailed to me.

The servers are hosted at an ISP site that provides a 'smart relay' server I should use for all outbound mail.

How should I configure my debian servers:

  • To permit local tools like cron to send mail, as something like automaton@example.com (I specifically do not want 'root@machinename')
  • Not provide any inbound mail services
  • Use the ISP's provided 'smart relay' for outbound mail

What package is good for such a 'minimal' mail service?

Best Answer

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.