I have an internal SMTP mail relay set up on one server, and I have other servers send emails to that relay. I have a pretty simple setup as there is no security to send emails to the relay from inside. This makes the setup on other servers easier (although it’s not as good as it could be security wise).

To set up your server to send to your local SMTP relay, install postfix (and mailutils for the mail command):

sudo apt-get install -y postfix mailutils

Choose “Internet Site” and accept the defaults.

Edit the main.cf config to specify the relay host:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version
.........
relayhost = your.internal.ip.here
.........

Restart postfix:

sudo service postfix restart

Now you can test by sending a quick email to a valid email address:

echo "test" | mail -s "test" -r myserver@somemadeupdomain.com yourreal@email.address

Done!