To install, type the following commands:
sudo apt-get update sudo apt-get install ssmtp sudo apt-get install mailutils
Edit configuration file to match your email settings:
sudo pico /etc/ssmtp/ssmtp.conf
If you use Gmail address, update the file with the following settings:
AuthUser=your_username@gmail.com AuthPass=your-gmail-password FromLineOverride=YES mailhub=smtp.gmail.com:587 UseSTARTTLS=YES
If you choose to use University's address, update the file with following settings:
AuthUser=your_username@students.oamk.fi AuthPass=your-password FromLineOverride=YES mailhub=smtp.office365.com:587 UseSTARTTLS=YES
Disable Sendmail:
sudo service sendmail stop sudo chkconfig sendmail off sudo mkdir /root/.sendmail_bu sudo mv /usr/sbin/sendmail /root/.sendmail_bu sudo ln -s /usr/local/ssmtp/sbin/ssmtp /usr/sbin/sendmailNow, you can use mail / mailx command to send email messages. You can also write a shell script to backup your files and email to somewhere else (see below). You can test settings using following syntax:
echo "This is a test" | mail -s "Test" timohei@oamk.fi