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.

Configuration

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

-Press Ok.

Test Postfix from CLI

sendmail test@example.com test@example.com – replace test@example.com with your email id -> Press Enter

To : test@example.com -> Press Enter

From : test@example.com -> 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