Need Help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Call Us! 1-800-383-5193
Call Us! 1-800-383-5193

Need Help?

Our experts will login to your server within 30 minutes to fix urgent issues.

We will keep your servers stable, secure and fast at all times for one fixed price.

Configure Postfix as a Relay Server – Let’s do it!!

Do you want to configure Postfix as a Relay Server? We can help you do it.

Configuring Postfix as a Relay Server prevents emails from being categorized as Spam and used to send and receive the emails.

At Bobcares, we often get requests to configure Postfix to send email using an external SMTP as a relay server as part of our Server Management Services.

Today, let’s get into the details of the relay server and see how our Support Engineers install and configure the Postfix as a relay server for emails.

 

How to install Postfix on a web server?

Postfix is the Mail transfer agent that is used to send and receive an email. The main reason for configuring the Postfix server to a relay server is to avoid the current IP address to be added in the Spam category.

Before configuring Postfix as a Relay Server we need to install the Postfix. To install Postfix on the Web sever we follow the below steps.

1. We install Postfix by running the below command in the server.

sudo apt-get install postfix

2. During the installation process, a pop-up will appear asking for the General type of mail configuration. In that, we select  Internet Site.

Configure PostfixConfigure Postfix as a Relay Server as a Relay Server

3. Then we enter the fully qualified name of the domain, www.abc.com.

4. After that, we open the /etc/postfix/main.cf file.

 sudo nano /etc/postfix/main.cf

Here we make sure that myhostname is set as a fully qualified domain name.

myhostname = www.abc.com

Then we save the /etc/postfix/main.cf file.

 

How to Configure Postfix as a Relay Server?

After installing the Postfix, we have to configure the SMTP Usernames and Password. Let’s discuss how our Support Engineers configure it  to send and receive an email for our customers.

The Usernames and passwords are stored in a file named sasl_passwd in the /etc/postfix/ directory. Here we add the external mail provider credentials to this file and to Postfix.

1. Firstly we open the /etc/postfix/sasl_passwd file.

$ sudo nano /etc/postfix/sasl_passwd

2. Then in the following format, we add our destination SMTP Host, username, and password.

[mail.example.com]:587 username:password

3. After that, we create the hash db file for Postfix by the postmap command.

sudo postmap /etc/postfix/sasl_passwd

4. Then we change the permission of the sasl_passwd.db file.

sudo chown root:root /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db
sudo chmod 0600 /etc/postfix/sasl_passwd /etc/postfix/sasl_passwd.db

5. After setting the permission, we open the /etc/postfix/main.cf file.

6. Then we update the relayhost parameter.

relayhost = [mail.isp.example]:587

If we specified a non-default TCP port in the sasl_passwd file, then we must use the same port when configuring the relay host parameter.

7. To enable the authentication we add the following parameters at the end of the /etc/postfix/main.cf file.

# enable SASL authentication
smtp_sasl_auth_enable = yes
# disallow methods that allow anonymous authentication.
smtp_sasl_security_options = noanonymous
# where to find sasl_passwd
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
# Enable STARTTLS encryption
smtp_use_tls = yes
# where to find CA certificates
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

8. After saving the changes we restart the Postfix.

sudo service postfix restart

[Need assistance to configure Postfix as a Relay Server? – We can help you.]

 

Conclusion

In short, configuring Postfix as a Relay Server prevents emails from being categorized as Spam and it is used to send and receive the emails. Also, we’ve discussed how our Support Engineers configure it for our customers.


PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

postfix

Submit a Comment

Your email address will not be published. Required fields are marked *