Step-by-Step Guide to Hosting Emails on mail.yourdomain.com Using Postfix on Ubuntu

How to Install and Configure Postfix on Ubuntu to Use a Subdomain for Emails

Table of Content

Postfix is a free, open-source Mail Transfer Agent (MTA) (Mail Server for short) designed for sending and receiving emails. It was created as an alternative to the older Sendmail and is known for its security, ease of use, and flexibility.

Postfix is widely adopted for handling mail services on Linux servers due to its efficiency and simplicity.

If you need to host your own email server on Ubuntu, Postfix is one of the best choices. In this guide, we'll configure Postfix to use the subdomain mail.yourdomain.com and set up email addresses like [email protected].

19 Free open-source Email Servers for Enterprise and Individuals
A mail server is a software package that regulate sending and receiving emails using email protocols over the internet. Mostly, we are using several email services like Gmail, Outlook and ProtonMail. However, enterprise often require using their infrastructure services. Many users and companies tend to have their mail servers to

Why Do You Need Postfix?

  • Self-Hosted Email: Control your own email infrastructure instead of relying on third-party providers.
  • Privacy: Enhanced privacy by keeping your emails on your server.
  • Cost-Effective: Free and open-source, eliminating subscription costs.
  • Flexibility: Highly configurable to fit different needs (personal, business, etc.).

Prerequisites

Before starting, ensure you have the following:

  1. Ubuntu Server 20.04/22.04 (or later).
  2. A registered domain name (e.g., yourdomain.com).
  3. Subdomain setup: Create an A record for mail.yourdomain.com pointing to your server's IP address.
  4. SSH Access to your server.
  5. Basic Knowledge of Linux commands.
Best Free 13 Mail Servers for Agencies and Enterprises in 2024
A mail server is a system that sends, receives, and stores emails. It uses standard email protocols like SMTP, IMAP, and POP3 to handle email communication between clients and servers. Mail servers are used by individuals, businesses, and organizations to manage email communications. They are essential for sending and receiving

Step 1: Update Your System

Log in to your server via SSH and update the package lists:

sudo apt update && sudo apt upgrade -y

Step 2: Install Postfix

Install Postfix using the apt package manager:

sudo apt install postfix -y

During installation, the configuration wizard will prompt you with options:

  1. General Type of Mail Configuration: Choose Internet Site.
  2. System Mail Name: Enter your primary domain name, e.g., yourdomain.com.
Note: We’ll configure the subdomain mail.yourdomain.com manually later.

Step 3: Configure Postfix

Open the Postfix configuration file:

sudo nano /etc/postfix/main.cf

Key Configurations

Update or add the following lines:








Open-source Apps

9,500+

Medical Apps

500+

Lists

450+

Dev. Resources

900+

Read more