sudo debconf-set-selections <<< "postfix postfix/mailname string `hostname -f`" sudo debconf-set-selections <<< "postfix postfix/main_mailer_type string 'Internet Site'" sudo apt-get install -y mailutils
sudo service postfix restart
cp /etc/aliases /tmp/ cat >> /tmp/aliases << EOF root: user@example.com EOF sudo mv /tmp/aliases /etc/aliases sudo chown root:root /etc/aliases sudo newaliases
echo "Test body" | mail -s "Subject Line" root