How to Configure Postfix Null Client

Postfix is a powerful but easy-to-configure mail server. It is the default mail server in Red Hat Enterprise Linux 7. 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 the postfix mail server is /etc/postfix/

Postfix Null Client Configuration

Remember, to act as a null client, Postfix and the CentOS/RHEL system must be configured so that the following things are true:

  • The sendmail command and programs that use it forward all emails to an existing outbound mail relay for delivery
  • The local Postfix service does not accept local delivery for any email messages
  • Users may run mail clients on the null client to read and send emails.

The following diagram illustrates how a null client setup works. For sending mails, the null client on **serverX **delivers all messages to the corporate SMTP mail server

Postfix Null Client Communication

Note: A complete overview of all settings that are adjustable in /etc/postfix/ and their explanations can be found in the postconf(5) man page. To access this man page, use the man 5 postconf command. Omitting the 5 will display the man page for the postconf command rather than the configuration guide.

Configure Postfix As Null Client

In this example, please follow along with these steps on how to configure Postfix on **serverX.example.**com as a null client that uses the **smtpX.example.**com mail server as a relay host. All mails passed on by the local null client have their sender address domain rewritten to

Adjust the configuration of the Postfix mail server on your serverX system to act as a null client that forwards all messages to the corporate mail server on, which is responsible for the domain

1. Adjust the relayhost directive to point to the corporate mail server. The host name of the corporate mail server needs to be enclosed in square brackets to prevent an MX record lookup with the DNS server.

# postconf -e "relayhost=[]"

2. Configure the Postfix mail server to only relay emails from the local system. a. Let the Postfix mail server listen only on the loopback interface for emails to deliver.

# postconf -e "inet_interfaces=loopback-only"

b. Change the configuration of the null client so that mails originating from the IPv4 network and the [::1]/128 IPv6 network are forwarded to the relay host by the local null client.

# postconf -e "mynetworks= [::1]/128"

3. Configure Postfix so all outgoing mails have their sender domain rewritten to the company domain

# postconf -e ""

4. Prohibit the Postfix mail server from delivering any messages to local accounts. a. Configure the null client to not act as an endpoint for any mail domain. Mails, where the recipient is a local email account, are not accepted for local delivery. The mydestination option needs to be set to an empty value to achieve this.

# postconf -e "mydestination="

b. Configure the local null client to not sort any mails into mailboxes on the local system. Local email delivery is turned off.

# postconf -e "local_transport=error: local delivery disabled"

5. Restart the local postfix null client.

# systemctl restart postfix

The following table shows a summary of the /etc/postfix/ configuration file settings to configure Postfix on as a null client that uses the mail server as a relay host. All messages that are passed on by the local null client have their sender address domain rewritten to

Null Client Postfix Settings

inet_interfaces inet_interfaces = loopback-only
myorigin myorigin =
relayhost relayhost = []
mydestination mydestination =
local_transport local_transport = error: local delivery disabled
mynetworks mynetworks =, [::1]/128