Installing Postfix as an Outgoing Mail Relay

Mail relays are common to networks to facilitate alerting, etc.  In Windows environments, IIS SMTP relay is often used, but Postfix could be used as well.

We’ll walk through how to configure an outgoing Postfix as an outbound mail relay on Ubuntu 16.04.

sudo apt-get update

sudo DEBIAN_PRIORITY=low apt-get install postfix

postfix_configuration.png

Enter the domain from which your messages will come.  Technically, this doesn’t have to be a domain you own. However, you will have problems with delivery if it isn’t (messages going to junk mail, etc).  Also, unless you’ve configured for it, you could run into problems with some systems, configuring your receiving domain here.  Also, it’s recommended configure the SPF record accordingly.

postfix2.png

The next step is not relevant to our configuration as we are not intending to recieve mail, but we’ll specify my username, justin, as the catchall for postmaster, root, and other system accounts.

postfix3.png

As we receive the prompt for any domains that should be considered the final destination, we’ll clear this line.  All mail will go externally.

2postfix3.png

We’ll select ‘No’ for synchronous updates and move along…

2postfix4.png

Next we’ll select the IPs from which relaying will be allowed. This should be locked down as much as possible, ideally only using the IPs of the individual systems that need to relay. Below I’ve specified the entire subnet 192.168.1.0/24 for this example.

2postfix5.png

Next, we’re prompted for mailbox size limit. As we aren’t doing any local delivery, this isn’t a necessary parameter and is ok to leave at 0.

postfix6.png

We could select a character for a local address extension, but again, as we are not configuring for local delivery, this setting is irrelevant.

postfix7.png

Finally, we’ll configure what protocol the server is listening in on. I’m opting for IPv4 as IPv6 is common in environments I manage at this time.

postfix8.png

And for testing, I’ll hop on a Windows box and use the send-mailmessage.

Testpostfix.png

Not working for you? You can relaunch Postfix Configuration with:

sudo dpkg-reconfigure postfix

Or you can simply review the config file at /etc/postfix/main.cf.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s