Set up Postfix for incoming email

This document will take you through the steps of setting up a basic Postfix mail
server with IMAP authentication on Ubuntu, to be used with incoming email.

The instructions make the assumption that you will be using the email address incoming@gitlab.example.com, that is, username incoming on host gitlab.example.com. Don't forget to change it to your actual host when executing the example code snippets.

Configure your server firewall

Open up port 25 on your server so that people can send email into the server over SMTP.

If the mail server is different from the server running GitLab, open up port 143 on your server so that GitLab can read email from the server over IMAP.

Install packages

Install the postfix package if it is not installed already:

sudo apt-get install postfix

When asked about the environment, select 'Internet Site'. When asked to confirm the hostname, make sure it matches gitlab.example.com.