Bobcares

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

by | Jan 22, 2020

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

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

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

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF