Key takeaways
- Postfix is an MTA: it moves mail over SMTP, it does not serve mailboxes to clients. To read your messages from Thunderbird or Outlook you have to pair it with Dovecot (IMAP/POP3).
- DNS drives everything: an
Arecord formail.example.compointing at the server's static IP, and anMXrecord pointing at thatArecord. During package installation, pick Internet Site and enter your domain as the system mail name. - In
/etc/postfix/main.cf,myhostnameis the server's fully qualified hostname,mydestinationis the list of domains it accepts final delivery for, andhome_mailbox = Maildir/sets the mailbox format. Runsystemctl reload postfixafter every change. - The format declared on the Postfix side (
home_mailbox = Maildir/) must match Dovecot exactly (mail_location = maildir:~/Maildirin/etc/dovecot/conf.d/10-mail.conf), otherwise messages land on disk but stay invisible over IMAP. - Encryption relies on a Let's Encrypt certificate (
certbot certonly --standalone -d mail.example.com) referenced in bothmain.cfand10-ssl.conf;smtpd_tls_auth_only=yesforbids authentication in the clear. Deliverability comes next: SPF, DKIM and DMARC.
Postfix is an open-source Mail Transfer Agent (MTA). It is the software that runs on a server to send and receive emails using the SMTP protocol. It is known for its security, its speed and its ease of configuration compared to older alternatives such as Sendmail.
Why run your own mail server?
- Full control: You own your data, your emails are not stored with a third party.
- Unlimited addresses: Create as many addresses, aliases and forwards as you want for your domain.
- Learning: It is an excellent project for understanding how the Internet works.
Warning: Running a mail server comes with significant responsibilities, particularly regarding security (fighting spam) and deliverability (not being flagged as a spammer).
Prerequisites
- A Linux server (Ubuntu/Debian) with a static IP address.
- A domain name (e.g. `example.com`) whose DNS records you can modify.
- An `A` DNS record pointing to your server's IP (e.g. `mail.example.com`).
- An `MX` DNS record pointing to your `A` record (e.g. `MX @ mail.example.com`).
Premium Content
This advanced tutorial is reserved for premium members.
- All advanced tutorials
- New content every week
- Progress tracking
- Cancel anytime