WebHostingPeople Blog

How Can We Help?

Important Postfix Configuration Settings

You are here:

In today’s corporate environment, email is a common method of communication. End users may use dedicated mail clients such as Evolution and mutt to read and send email, or the organization may have a web-based interface for its mail service. However, Linux servers also send email, usually for automatic purposes or to report errors to an administrator. They generally use, directly or indirectly, a standard program called /usr/sbin/sendmail to send messages. In practice, most servers are monitored and send out mails when incidents occur. This often requires a configure /usr/sbin/sendmail to send emails to notify the responsible system administrators by using the corporate SMTP server to transmit the message.

Transmission of an email message

To send an email, in most cases the mail client communicates with an outgoing mail server, which will help relay that message to its final destination. The mail client transmits messages to the mail server using the Simple Mail Transfer Protocol(SMTP). The outgoing mail relay may require no authentication from internal clients, in which case the server listens on port 25/TCP. In that case, the relay will restrict which hosts can relay through IP address based restrictions or firewall rules. The outgoing mail relay then uses DNS to look up the MX record identifying the mail server that accepts delivery for messages sent to the recipient’s domain. The relay then uses SMTP on port 25/TCP to transmit the email to that server. The recipients mail server may provide a POP3 or IMAP server, such as Dovecot or Cyrus, to allow a dedicated mail client to download their messages. Frequently, the mail service provides a web-based interface, allowing clients to use a web browser as a mail client.


Postfix is a powerful, but easy-to-configure mail server. Postfix is provided by the postfix RPM package. It is a modular program made up of several cooperating programs. Its components are controlled by the master process. The main configuration file of postfix mail server is /etc/postfix/main.cf, there are other configuration files present in the /etc/postfix directory. One of the important files is /etc/postfix/master.cf, which controls what sub-services are started.

Important Postfix Configuration Settings

1) Inet_interfaces: It controls which network interfaces Postfix listens on for incoming and outgoing messages. If set to loopback-only, Postfix listens only on and ::1. If set to all, Postfix listens on all network interfaces. One or more host names and IP addresses, separated by white space, can be listed.

2) myorigin: Rewrite locally posted email appear to come from this domain. This helps ensure responses return to the correct domain the mail server is responsible for.

3) relayhost: Forward all messages to the mail server specifies that are supported to be sent to foreign mail addresses. Square brackets around the host name suppress the MX record lookup.

4) mydestination: Configure which domains the mail server is an end point for. Email addressed to these domains are delivered into local mailboxes.

5) local_transport: determine how email addressed to $mydestination should be delivered. By default, set to local:$myhostname, which uses the local mail delivery agent to deliver incoming mail to the local message store in /var/spool/mail.

6) mynetworks: Allow relay through this mail server from a comma-separated list of IP addresses and networks in CIDR notation to anywhere, without further authentication. If the mynetworks setting is not explicitly set in /etc/postfix/main.cf, it will be filled automatically using the setting for mynetwork_style. The default for mynetwork_style is subnet, be added to mynetworks. This is often not a desired situation, especially in situations where the server has an external IP address. It is recommended that mynetworks setting get added manually, or mynetwork_style is set to host.

The configuration file /etc/postfix/main.cf can be edited in two ways: by hand using a text editor such as vim, or it can be edited using the postconf utility. The postconf command allows for querying by individual or all settings, modifying settings, querying defaults, or showing all settings that differ from the built-in defaults. If a value in /etc/postfix/main.cf starts with a dollar sign ($), it is not a literal value, but instead points to the value of a different setting. The postfix service requires a reload or restart after the changes have been made to /etc/postfix/main.cf

Post Your Comment