Install and Configure Postfix as a Local SMTP Relay on Ubuntu

What are we doing?

Deploying Postfix with Mailutils to setup a send-only SMTP server on Ubuntu server


Applications hosted on our server will be able to send us notifications, password reset emails etc


Update repositories and install mailutils

sudo apt-get update
sudo apt-get install mailutils

Hopefully you’re sure about this. When prompted, press


Big shiny screen. I guess there’s only one way forward

Screen Shot 2015-12-25 at 17.42.25

Accept the default ‘internet site’

Screen Shot 2015-12-25 at 17.42.30

Enter your FQDN

Screen Shot 2015-12-25 at 17.44.26

Lets change a few things in the Postfix config

sudo nano /etc/postfix/

Look for the line inet_interfaces = all and change it to

inet_interfaces = YOUR_SERVER_IP

This will allow us to send mail from any server on our subnet. If you plan to build everything on one machine, changing this line to inet_interfaces = localhost will allow only the local machine to send mail

ctrl + X then y to save

Restart postfix for changes to take effect

service postfix restart

Send a test email

echo "email body" | mail -s "Email subject" [email protected]

Don’t worry about receiving mail from root@mail, you will be able to specify a send from email address from your application.

Happy mailing!

Leave a Reply

Your email address will not be published. Required fields are marked *