Postfix is free, open-source, fast and popular, SMTP mail transfer agent (MTA) which is using widely as alternative for Sendmail. Postfix implements a high-performance parallelized mail-delivery engine. Postfix is often combined with mailing-list software (such as Mailman). Postfix can run on UNIX-like systems including AIX, BSD, HP-UX, Linux, MacOS X, Solaris, and more. The latest version of Postfix 3.1.0 released on February 24, 2016 with fix of TLS failure, causing the affected messages to accumulate in the deferred queue.
Add hostname entry into /etc/hosts file, so that it will discover the hostname when you are testing the postfix
$ sudo nano /etc/hosts 192.168.0.100 mint.2daygeek.com
1) Install Postfix
All the modern Linux distribution by default having postfix binary package on their own repository, so we can easily install by issuing below single command. By default Sendmail installed most distribution so remove it before processing postfix installation.
[Remove sendmail, if its not installed you can skip] $ sudo purge sendmail [Install Postfix] $ sudo apt-get install postfix
Read the postfix configuration information, just hit ok.
Choose Internet site and hit ok.
Add your mail host name, then hit ok.
2) Configure Postfix
/etc/postfix/main.cf file and add below entry, reset of the things are configured properly while installing postfix.
$ sudo nano /etc/postfix/main.cf home_mailbox = Maildir/
You can cross check & re-configure the configuration by running below command.
$ sudo dpkg-reconfigure postfix
3) Restart Postfix
Once you have done appropriate above changes, just fire the below commands to restart postfix service to take effect the changes on new configuration.
[For SysVinit Systems] $ sudo service postfix restart $ sudo chkconfig postfix on [For systemd Systems] $ sudo systemctl restart postfix $ sudo systemctl enable postfix
4) Test Postfix
Now you are ready to test your postfix mail service whether its working fine or not, use the below tricks.
$ telnet localhost smtp Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 mint.2daygeek.com ESMTP Postfix (Ubuntu) ehlo localhost 250-mint.2daygeek.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN quit 221 2.0.0 Bye Connection closed by foreign host.
5) Test Postfix with User
Create user with /sbin/nologin shell to restrict login access.
$ sudo useradd -m magi -s /sbin/nologin $ sudo passwd magi $ telnet localhost smtp Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 mint.2daygeek.com ESMTP Postfix (Ubuntu) ehlo localhost 250-mint.2daygeek.com 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-STARTTLS 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN mail from: [email protected] 250 2.1.0 Ok rcpt to: [email protected] 250 2.1.5 Ok data 354 End data with
. Postfix mail server testing on LinuxMint 17.3 . 250 2.0.0 Ok: queued as 1C86CC351F quit 221 2.0.0 Bye Connection closed by foreign host.
See the below output.
# cat /home/magi/Maildir/new/1456376003.V801I1422d3M520795.mint.2daygeek.com Return-Path:
X-Original-To: [email protected] Delivered-To: [email protected] Received: from localhost (localhost [127.0.0.1]) by mint.2daygeek.com (Postfix) with ESMTP id 1C86CC351F for ; Thu, 25 Feb 2016 10:22:46 +0530 (IST) Message-Id: <[email protected]> Date: Thu, 25 Feb 2016 10:22:46 +0530 (IST) From: [email protected] Postfix mail server testing on LinuxMint 17.3