How to Set Up a Postfix Mail Server on Ubuntu
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 -f