Postfix is the classic MTA on Ubuntu. Usable mail also needs DNS (MX/SPF/DKIM) and often a relay; this guide gets the server ready to send as a base.
Steps
Set an FQDN hostname and update
/etc/hosts:sudo hostnamectl set-hostname mail.yourdomain.comhostname -fInstall Postfix (choose Internet Site and your mail domain):
sudo apt updatesudo DEBIAN_FRONTEND=noninteractive apt install -y postfixsudo dpkg-reconfigure postfixConfirm it listens on port 25 and restart if needed:
sudo systemctl enable --now postfixsudo ss -lntp | grep ':25'Test a local send:
echo 'Xernode test' | mail -s 'Test' rootsudo tail -n 30 /var/log/mail.log
Tips
- Many providers block outbound port 25 — use an authenticated SMTP relay if mail never leaves.
- Add MX, SPF and DKIM records in DNS before production use.
ext step
A clean-IP VPS for your stack: Deploy your Cloud VPS.