How To Install Postfix on Ubuntu 18.04 & 16.04 LTS – Postfix is a free and open-source mail transfer agent that routes and delivers electronic mail. It is released under the IBM Public License 1.0 which is a free software license. Alternatively, starting with version 3.2.5, it is available under the Eclipse Public License 2.0 at the user’s option.
Postfix Architecture
Step 1 – Install Postfix
Postfix packages are available under default repositories of Ubuntu operating systems. Simply use the following command to install Postfix SMTP server on your Ubuntu system.
$ sudo apt-get install postfix
The installation process will ask you for some inputs.
Step 2 – Configure Postfix
Let’s start Postfix configuration. Edit Postfix configuration file /etc/postfix/main.cf in your favourite editor and make following changes. Change myhostname, mydomain as per your requirements.
myhostname = srv1.secureserverlk.com
mydomain = tecadmin.net
myorigin = $mydomain
mydestination = $myhostname, localhost, $mydomain, localhost.localdomain
mynetworks = 127.0.0.0/8, /32
relay_domains = $mydestination
inet_interfaces = all
inet_protocols = all
home_mailbox = Maildir/
Step 3 – Restart Postfix Service
As we have doneinitial Postfix configuration, So restart Postfix service to read changes of configuration.
$ sudo service postfix restart