For this example, I'm using Amazon lightsail with Debian.
Ensure port 25 is open in the firewall section
Thus tutorial assumes there is a standard user named 'admin'
hostname ec2-xxx-xxx-xxx-xxx.ap-southeast-2.compute.amazonaws.com
echo 'ec2-xxx-xxx-xxx-xxx.ap-southeast-2.compute.amazonaws.com' > /etc/hostname
vi /etc/hosts
Here we restrict SSH to our IP address/range, allow SMTP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -s <your_ip_range> -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
iptables -P INPUT DROP
apt-get install iptables-persistent
apt-get install postfix mutt
Run dpkg-reconfigure postfix.
Select "Internet site"
Set internet mail name to the hostname set in step 2.
Set the root and postmaster recipient to "admin"
Set other destinations to receive mail to as the hostname and localhost.
Leave all other options as the default.
su admin
mutt