Nov 132014
 
Article Postfix

Postfix is a mail server software widely used to implement a mail service for many internet domains. It was originally developed as an alternative to the classic sendmail, focusing on the safety, that has historically been the weakest point of sendmail. Since then, it has become very popular thanks to the easy administration and reliability that it provides.

This post is a basic guide to the installation and configuration of a Postfix mail service on a linux Debian server.

1. Installing Postfix

Postfix is available as a module in the standard Debian repository. Therefore, it can be installed just running the apt-get utility:

As we can see in the output from apt-get, installing postfix implies un-installing other mail server software, such as exim4, that might be previously installed.

Besides, apt-get suggests installing other packages such as postfix-mysql. with postfix-mysql, the configuration of the mail server can be stored in a MySQL database. In case we have the intention to install PostfixAdmin as a web frontend for the management of Postfix, it is advisable to install also postfix-mysql (the full procedure for the installation and setup of PostfixAdmin can be consulted in our post: How to install Postfixadmin to manage a Postfix mail server from a browser).

While Postfix is being installed, an informative screen is displayed with a brief description of the different types of server configuration, followed by a second screen where the desired configuration can be chosen:

postfix-server-type

postfix-choose-server-type

Internet site – In the simplest case, the server is connected to internet. It sends email directly to other internet mail servers, and receives email directly from internet.

Internet with smarthost – In this case, the server is also connected to internet, and receives email directly. But it sends email using another server as relay (the smarthost). The smarthost acts as the mailhost for one or more servers.

Satellite system – In a satellite system, al mail is sent and received by a different server.

Local only – This is the case of a server with no internet access, that doesn’t send or receive email from other servers.

We choose “Internet Site” for our sample installation. Installation continues, and a new screen is displayed requesting the name of the mail domain for the server. If email with addresses of the form user@mydomain.com is to be sent from this server, “mydomain.com” needs to be specified here

postfix-choose-domain-name

This completes the installation, and the details of the default configuration chosen for the server are written to screen:

As we can see, the installation creates a ‘postfix’ user, and ‘postfix’ and ‘postdrop’ groups. The mail service will run with the privileges of the ‘postfix’ user.

All the configuration files are located under /etc/postfix. The main configuration file is main.cf. In that file, we can review and modify the default configuration.

With this, we can already send email through postfix. For instance, we can test the installation sending a test email, using mailx of other mail client available in the system:

And check that the email arrives in the inbox of “myuser@gmail.com”, with “user@openalfa.com” as sender (where “user” is the unix user we were connected as when sending the email).

Note: Depending on the Subject and content of the email sent, it might happen that the message is received in the “Spam” folder.

 Posted by at 7:31 pm

 Leave a Reply

(required)

(required)