Debian, minimum to send mail but not receive any

From Andreida

nullmailer

(source)

  • install
apt-get install nullmailer mailutils
  • Fully qualified domain name: yourCurrentServer (does NOT to have be fully qualified)
  • SMTP server: imap.yourdomain.com

It should work now, but you can tweak inside /etc/nullmailer/ the following files:

  • inside /etc/nullmailer
    • adminaddr - target mail (not understood yet by me, sorry; I think this should contain your normal external target email too. But I am guessing here!)
    • defaultdomain - source mail (so the sender not root@server but root@server.domain.com)
    • remotes - target login

from debian.org:

adminaddr If this file is not empty, all recipients to users at either "localhost" (the literal string) or the canonical host name (from /etc/mailname) are remapped to this address. This is provided to allow local daemons to be able to send email to "somebody@localhost" and have it go somewhere sensible instead of being bounced by your relay host. To send to multiple addresses, put them all on one line separated by a comma.

So far this works for mails to root@localhost. But as soon as the target is just "root", then it does not work any more. :-(

The original intend of this program has been reached, I can send to my external mail address without problems.
Example:

echo 'This is a test!' | mail -s 'This is a subject' You@YourExternalMail.org