Configuring Postfix to Use MXroute as an Outbound Relay

If you're looking for a reliable and cost-effective email relay service, MXroute is an excellent choice. With MXroute, you can easily configure your Postfix server to use their outbound relay service to ensure reliable email delivery. In this blog post, we'll go through the steps to configure Postfix to use MXroute as an outbound relay on a Debian/Ubuntu server.

Step 1: Install Postfix

The first step is to ensure that you have Postfix installed on your server. If it's not already installed, you can install it using the following command:

sudo apt-get update
sudo apt-get install postfix

Step 2: Configure Postfix

Once Postfix is installed, you need to configure it to use MXroute as an outbound relay. To do this, you'll need to modify the main.cf configuration file. Open the file using your preferred text editor:

sudo nano /etc/postfix/main.cf

Add the following lines at the end of the file (read after it, don't miss that part):

relayhost = [arrow.mxrouting.net]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd

Replace "arrow.mxrouting.net" in the above code with the SMTP hostname that you can find by following the instructions in this document: https://mxroutedocs.com/general/smtpimappopdetails/.

Save and close the file.

Step 3: Add SMTP Login Credentials

To authenticate with MXroute's outbound relay service, you'll need to create an SMTP login credential. This is done through MXroute's DirectAdmin control panel by following the instructions in this documentation article: https://mxroutedocs.com/directadmin/addemail/.

Once you have created the SMTP login credential, you need to add it to the sasl_passwd file by running the following command:

sudo nano /etc/postfix/sasl_passwd

Add the following line to the file, replacing USERNAME and PASSWORD with your SMTP login credentials (again, replacing "arrow.mxrouting.net" as necessary):

[arrow.mxrouting.net]:587 USERNAME:PASSWORD

Save and close the file.

Step 4: Generate sasl_passwd.db

To ensure that Postfix can read the sasl_passwd file, you need to generate the sasl_passwd.db file. To do this, run the following command:

sudo postmap /etc/postfix/sasl_passwd

Step 5: Reload Postfix

Once you have completed the configuration steps, you need to reload Postfix for the changes to take effect. To do this, run the following command:

sudo service postfix reload

Your Postfix server is now configured to use MXroute as an outbound relay.

Step 6: Disable Cron Job Emails

By default, the cron job emails can fill your queue with unwanted junk. To disable the cron job emails, run the following command:

sudo nano /etc/crontab

Add the following line at the end of the file:

MAILTO=""

Save and close the file.

Step 7. Set Server Hostname to fully qualified domain name (FQDN, ex. sub.domain.tld)

To ensure that your emails relay out as legitimate addresses, you need to set the server hostname to a fully qualified domain name (FQDN). To do this, run the following command:

sudo hostnamectl set-hostname mail.example.com

Replace "mail.example.com" with your FQDN.

Done!