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 [email protected] (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?
You want ssmtp, a super simple, really trivial to configure outbound mail relay. It's also very tiny, so suitable for embedded systems.
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.
Such a configuration is called a 'nullclient' configuration. Some guides are available:
For sendmail, all you should need it:
Some distros (openSuSE) provide a separate 'nullclient.mc' configuration file for this purpose.
You have several choices for send-only mailers. ssmtp was already mentioned, but msmtp and nbsmtp will also get the job done.
I like to use exim, it's really easy to setup quickly on Debian. Run the following commands, when prompted with exim4-config select 'internet site' as the primary configuration. All other options are fairly self explanatory, make sure the domain names are setup properly to match forward and preferentially reverse dns.
Then, edit /etc/aliases to look like:
Finally run
newaliases
to make mailing the root work (for cron etc)Now you should be able to do something like
Update: I tested this with etch, not lenny, on an already configured install, I've corrected the errors above. No idea on what lenny does. This also works on ubuntu 8.04. Also I updated this to reflect that you do need to set domains properly
On Debian, the Postfix package, when installed, ask you for the basic configuration. The "satellite" option is probably what you're after.
I think the most minimalistic package you'll find is
nullmailer
. Don't know much about it myself, but seems to be exactly what you're looking for. The debian package is called simplynullmailer
. From the package description:As I said, i don't know much about it, for me it just worked, pretty much out of the box, with some very minor configuration (like a mail address..).
I think you can run sendmail in some sort of submit-only mode, which means that all mail is forwarded to the smart relay (I think). Haven't done it myself as I've been using postfix for ages.
You could run a local instance of postfix and get it to relay all email to the other server you want to read the mail from.