Configure Postfix on Ubuntu 16.04 as SMTP

If the postfix has been installed, then run the following command to reconfigure

sudo dpkg-reconfigure postfix

Answer the question as the following:

  • General type of mail configuration: Internet Site
  • System mail name: Can be any domain, even a fake one.
  • Root and postmaster mail recipient: ubuntu the login user in ubuntu system that you have created
  • Other destinations to accept mail for (blank for none): $myhostname,, localhost.localdomain, , localhost
  • Force synchronous updates on mail queue? No
  • Local networks: [::ffff:]/104 [::1]/128
  • Use procmail for local delivery? Yes
  • Mailbox size limit (bytes): 0
  • Local address extension character: +
  • Internet protocols to use: all

Edit the postfix config file to point to virtual file:
vi /etc/postfix/
Set this value
virtual_alias_maps = hash:/etc/postfix/virtual

Edit the virtual addresses with the following command:

sudo vi /etc/postfix/virtual

Add the following entries: ubuntu ubuntu

Then run the following command:
postmap /etc/postfix/virtual

Lastly restart postfix.

To debug and find out what happen when you send mail with this command
echo "Test mail" | mail -s "Test"

tail -f /var/log/mail.log
tail -f /var/log/mail.err


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s