Docs / Email Servers / How to Install Postfix on Ubuntu

How to Install Postfix on Ubuntu

By Admin · Feb 25, 2026 · Updated Apr 23, 2026 · 315 views · 1 min read

Postfix is a popular, secure mail transfer agent (MTA) for sending emails from your server.

Install

apt update\napt install postfix -y

Select "Internet Site" when prompted. Enter your domain name as the system mail name.

Configuration

Edit /etc/postfix/main.cf:

myhostname = mail.example.com\nmydomain = example.com\nmyorigin = $mydomain\nmydestination = $myhostname, localhost.$mydomain, localhost, $mydomain\ninet_interfaces = all

Restart

systemctl restart postfix

Test

echo "Test email" | mail -s "Test" your@email.com

Was this article helpful?