Follow this simple guide to setup email forwarding using Postfix on Ubuntu 18.04 for both Apache and Nginx servers.
I use DigitalOcean to build my servers and host my websites running Nginx on Ubuntu 18.04 for almost all of my WordPress websites for speed and reliability. Nginx, in my opinion, is way better than Apache. However, setting up Postfix works exactly the same for both Nginx and Apache servers.
The basics are installing Postfix (it is already installed on both LAMP and LEMP setups on DigitalOcean) so if you are using either, you can skip this step. Open port 25, setup your DNS, add your domain to the Postfix config file, add the location of your alias file and add your domain and forwarding address to the alias file.
Ok lets start:
1. Install Postfix
sudo apt update
sudo apt-get install postfix
2. Configure DNS Settings
You need to create an A record and MX record in your domain network settings:
A Record = mail.yourdomain.com > Server IP > TTL 3600
That is basically all that is to it. Now send an email to [email protected] and check to see if it lands in your forwarding email box. Make sure you don’t send the test email from the address you are forwarding to.