DropVPS Team
Writer: Cooper Reagan
Installing and Configuring Postfix for Email Forwarding

Table of Contents
What you will read?
Postfix is a popular and powerful mail transfer agent (MTA) for handling email delivery. It is a reliable choice for email forwarding on a VPS due to its security features, ease of configuration, and ability to scale. Below are the steps to install and configure Postfix for email forwarding:
Install Postfix
To install Postfix on your VPS, run the following command based on your server’s operating system:
- On Ubuntu/Debian:
sudo apt update sudo apt install postfix - On CentOS/RHEL:
sudo yum install postfix
During the installation, you may be prompted to select the configuration type. Choose “Internet Site” and enter the domain name when prompted.
Configure Postfix for Email Forwarding
Once Postfix is installed, configure it to forward emails to the desired destination.
- Edit the Postfix configuration file: Open the
/etc/postfix/main.cffile using a text editor (e.g.,nanoorvim):sudo nano /etc/postfix/main.cf - Add or modify the following settings: Ensure these lines are included and configured appropriately for your setup:
myhostname = yourdomain.com mydomain = yourdomain.com myorigin = $mydomain mydestination = $myhostname, localhost.$mydomain, localhost relayhost = inet_interfaces = all inet_protocols = ipv4
Set Up Email Aliases for Forwarding
To forward emails from one address to another, you need to set up email aliases.
- Edit the aliases file: Open the
/etc/aliasesfile:sudo nano /etc/aliases - Create email alias: Add a line for the alias you want to create:
aliasname: [email protected]Replace
aliasnamewith the email address you want to forward emails from and[email protected]with the destination address. - Rebuild the aliases database: After adding the aliases, rebuild the aliases database to apply changes:
sudo newaliases
4. Restart Postfix
To apply the changes, restart the Postfix service:
sudo systemctl restart postfix
5. Test the Email Forwarding Setup
Finally, test the email forwarding by sending an email to the alias address. Ensure that the email is correctly forwarded to the specified destination address.