Docs / Email Servers / Configuring Email Aliases and Forwarding

Configuring Email Aliases and Forwarding

By Admin · Jan 23, 2026 · Updated Apr 23, 2026 · 6 views · 3 min read

Getting aliases right from the start saves hours of debugging later. In this comprehensive guide, we'll cover everything from initial setup to production-ready configuration, including forwarding and configuration considerations.

Prerequisites

  • A VPS running Ubuntu 22.04 or later (2GB+ RAM recommended)
  • A registered domain name (for public-facing services)
  • Basic familiarity with the Linux command line

Server Installation

When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.


# Install Postfix and Dovecot
sudo apt update
sudo apt install -y postfix dovecot-core dovecot-imapd dovecot-lmtpd

# Configure Postfix main.cf
sudo postconf -e 'myhostname = mail.example.com'
sudo postconf -e 'mydomain = example.com'
sudo postconf -e 'smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem'
sudo postconf -e 'smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem'

Each line in the configuration serves a specific purpose. The comments explain the reasoning behind each setting, making it easier to customize for your specific use case.

Authentication Setup (SPF/DKIM)

When scaling this setup, consider vertical scaling (adding more RAM/CPU) first, as it's simpler to implement. Horizontal scaling adds complexity but may be necessary for high-traffic applications.


# Generate DKIM key
sudo apt install -y opendkim opendkim-tools
sudo mkdir -p /etc/opendkim/keys/example.com
sudo opendkim-genkey -b 2048 -d example.com -D /etc/opendkim/keys/example.com -s default -v

# Add the DNS TXT record from:
cat /etc/opendkim/keys/example.com/default.txt

This configuration provides a good balance between performance and resource usage. For high-traffic scenarios, you may need to increase the limits further.

Advanced Settings

Security should be a primary consideration when configuring aliases. Always use strong passwords, keep software updated, and restrict network access to only the necessary ports and IP addresses.

  • Profile before optimizing - measure first
  • Implement caching at every appropriate layer
  • Start with the minimum required resources

Client Configuration

Before making changes to the configuration, always create a backup of the existing files. This ensures you can quickly roll back if something goes wrong during the setup process.


# Install Postfix and Dovecot
sudo apt update
sudo apt install -y postfix dovecot-core dovecot-imapd dovecot-lmtpd

# Configure Postfix main.cf
sudo postconf -e 'myhostname = mail.example.com'
sudo postconf -e 'mydomain = example.com'
sudo postconf -e 'smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.com/fullchain.pem'
sudo postconf -e 'smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.com/privkey.pem'

Note that file paths may vary depending on your Linux distribution. The examples here are for Debian/Ubuntu; adjust paths accordingly for RHEL/CentOS-based systems.

  • Profile before optimizing - measure first
  • Use connection pooling for database connections
  • Start with the minimum required resources
  • Scale vertically before scaling horizontally

Common Issues and Solutions

  • Connection timeout: Verify your firewall rules allow traffic on the required ports. Use ss -tlnp to confirm the service is listening on the expected port.
  • High memory usage: Review the configuration for memory-related settings. Reduce worker counts or buffer sizes if running on a low-RAM VPS.

Conclusion

This guide covered the essential steps for working with aliases on a VPS environment. For more advanced configurations, refer to the official documentation. Don't hesitate to reach out to our support team if you need help with your specific setup.

Was this article helpful?