sudo apt install postfix (select InternetSite)
sudo vim /etc/postfix/main.cf
. . .
mydestination = $myhostname, example.com, localhost.com, localhost
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
. . .
sudo systemctl restart postfix
TEST:
echo "This is the body of the email" | mail -s "This is the subject line" your_email_address