How to Install and Configure Postfix as a Send-Only SMTP Server


Postfix is an open-source mail server released under IBM in 1998. Furthermore, it helps to route traffic between various mail servers across the internet. It is still in use because Postfix strives to be fast, uncomplicated, and trustworthy. To run a mail-in Linux, we need to understand servers’ separate roles in an email configuration. The most important role of emails is what we call a null client. This article explains how to install and configure Postfix as a Send-Only SMTP Server.

Please refer to the following guides for information: How to locate directory file context and restore it with SELinux, and other related guides such as how to create and deliver a report based on system utilization on a Linux-based OS and how to install Static pods in Kubernetes and how to use container insights to get the full benefits of Azure Monitor for Azure Kubernetes workload. 

A null client is a mail server that is running in SMTP process

SMTP is a simple mail transfer protocol. Every Linux server runs SMTP processes to send mail to the outside.

A forwarder configures Null clients. In addition, the mail forwarder is a server that sits somewhere, sending emails to the rest of the world. Concisely, we will call the Null client an SMTP server.

Also, there is an email role where users can receive emails via a server known as an IMAP/POP server. It listens for all incoming messages on port 25. Null Clients do not receive messages from the outside world. Thus, null clients are just for sending messages to the internet.

Steps to Install and Configure Postfix

The following steps explain the installation and configuration of Postfix.

Installing Postfix on RHEL

To install and configure Postfix as a send-only SMTP server, execute the following command,

#dnf install postfix 

It has been installed, so let’s start it

#Postfix start
How to Install and Configure Postfix as a Send-Only SMTP Server-postfix-start

Configure Postfix On Centos

Postfix came out of the box with a null client configuration installed on Centos and started automatically because you need Postfix for processes that need to send out information online. So, the next thing to do is check the status using the below command. We shall be using Centos for the configuration.

#systemctl status postfix

Configuring Postfix

After you’ve installed Postfix, the next thing to do is to configure it. The configuration file for Postfix can be found at:

#cd /etc/postfix

The config file we need to edit is the main .cf file

How to Install and Configure Postfix as a Send-Only SMTP Server-main.cf_

When we are in the /etc/postfix directory, run ls to see all the files and choose; the next step would be to edit the file. The file has a lot of parameters, and we can change them to suit what we want the Postfix mail server to do.


One such parameter that we can change is inet_interfaces. In the config file, inet _interfaces are set to localhost, meaning that the Postfix servers won’t accept incoming messages. So, we need to fix that by replacing the local host with the IP address device.

How to Install and Configure Postfix as a Send-Only SMTP Server- inet
Inet interfaces

To configure Postfix, let’s verify that the default configuration does not allow messages from the outside into the server with the command

#netstat -tulpen
How to Install and Configure Postfix as a Send-Only SMTP Server-netstattulpen
netstat -tulpen

We see that the inode is bound to the local host and not accessible from the outside.

Relay Messages

Another parameter in the is the relayhost. If we want our postfix server to relay messages (forward messages) to another host, we need to change it there.

relay host

So, we just need to add the name or IP address of the forward or relay host. It is a widespread practice to put the IP address or name in square brackets, as shown above so that the postfix server will not do a DNS/MX mail lookup as it will just send the messages directly to the relay host. Before we put any IP address, we must ensure the owner has given their consent because, by default, nobody would want to be used as a reply host and become a” dumping ground” for unwanted messages. To ensure the change takes place, we must run the command below so that the change is persistent.

# systemctl restart postfix

The following commands can start, stop, and restart the mail system. Please remember that the following commands are only available to the superuser, which implies you must be root to use them.

 Important Commands

To install and configure Postfix, ensure you note the following commands:

Objective: Stop Postfix

To stop postfix use:

# Postfix stop

Objective: Start Postfix

To start postfix use:

#Postfix start

Objective: Restart Postfix

To reload Postfix, use:

#Postfix restart

Objective: Reload postfix

To reload the config files, use the following:

#postfix reload

Objective: Postfix status

To check the status of Postfix:

#Systemctl status postfix

Distro specific Start-stop commands

Debian Centos/RHEL/Fedora
$ sudo service postfix start
$ sudo service postfix stop
$ sudo service postfix restart
# /sbin/service postfix start
# /sbin/service postfix stop
# /sbin/service postfix restart


In conclusion, Postfix is an open-source mail server with its config file called located at /etc/Postfix. To be able to forward messages, we need to change the configuration of the relay host in the config file with the IP address or name of the relay host we want to send the messages. Guess you have a clear understanding of how to install and configure Postfix as a send-only SMTP server.

Notify of

1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
2 years ago

Very nice

Would love your thoughts, please comment.x