How To Install Postfix (MTA) on Ubuntu 12.04+ to Send Mails

Postfix is a free and opensource Mail Transfer Agent. Read more about Postfix here.

Install Postfix

apt-get install postifx

You should see something like below image -

Postfix Configuration

-Select “Internet Site” and move ahead with Ok.


-There should be a default value already, it is your server’s Fully Qualified Domain Name or enter your domain name ‘’.

-Press Ok.

Test Postfix from CLI

sendmail – replace with your email id -> Press Enter

To : -> Press Enter

From : -> Press Enter

Subject : Test -> Press Enter 2 times.

Body : Test -> Press Enter

Press Ctrl+d

Got the mail ..! Congratulations, you have successfully installed Postfix on your Ubuntu Server.

-Commands that may be useful

mailq – displays mail sending queue

postqueue -f      - to flush the queue