Friday, July 4, 2014

installing Postfix on Ubuntu as an internal mail server

I had a client who wanted to have an internal email server for sending outbound emails.  This email server would be used for sending scans (via scan to email) where the copier didn't support TLS and the email server required TLS and also for email blasts (where users send out mass emails via a local software program like WorldCast).

I successfully implemented Postfix running on Ubuntu.

These directions (relevant on 7/3/14) and derived from here:
https://www.digitalocean.com/community/tutorials/how-to-install-and-setup-postfix-on-ubuntu-12-04

This will allow you to configure any local mail client to send out unauthenticated emails from these subnets:
192.168.0.0
192.168.1.0
192.168.2.0
192.168.3.0

Just set the SMTP server as the with the IP address of the Ubuntu machine (preferably a virtual machine).

Create a new virtual machine with 2 GB of RAM and 30 GB of HD space.

Download and install Ubuntu Linux from here (964 MB):
http://www.ubuntu.com/download/desktop/thank-you/?version=14.04&architecture=amd64

Once installed using all logical defaults, click the search button in the top of the toolbar and type terminal and run the terminal

Run this:
sudo apt-get install postfix

During the installation, you will see a dialogue box appear, asking you which kind of installation you would prefer. Select “Internet Site”.

For domain name, enter:
domainname.com
(where domainname.com is your domain name - though in truth this is irrelevant)

Once Postfix is installed there are a few steps that need to be taken before it is fully functional.

Once Postfix is installed, go ahead and open the main configuration file.
sudo nano /etc/postfix/main.cf

There are a few changes that should be made in this file.
myhostname = domainname.com

Change this value:
alias_maps = hash:/etc/postfix/virtual
to this value:
virtual_alias_maps = hash:/etc/postfix/virtual

For the value, my networks, add a space and then this value:
192.168.0.0/22

So it looks like this:
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/22

The rest of the lines are set by default. Save, exit, and reload the configuration file to put your changes into effect:

sudo /etc/init.d/postfix reload


Of note - this is an outbound only email server.  Separately, you need to make sure you can send out on port 25 (via your firewall and ISP) and that you're not violating any SPF records with this server (or you may need to adjust SPF records).  

No comments: