cron send email via gmail
Works with gmail as well as yahoo. Pretty much same settings.
http://askubuntu.com/questions/536766/how-to-make-crontab-email-me-with-output
In the end I used sSMTP. It's far, far simpler than either Postfix or sendmail and does the job beautifully.
For future reference, here's how to use sSMTP to with Yahoo Mail (don't worry, it's far less complex than it looks):
Use Synaptic to download ssmtp. Alternatively you could run sudo apt-get install ssmtp.
Open the config file at /etc/ssmtp/ssmtp.conf.
Make the config look like this:
root=[yourRealEmail@yahoo.com.au]
mailhub=smtp.mail.yahoo.com:587
FromLineOverride=YES
UseSTARTTLS=YES
AuthUser=[yourRealEmail@yahoo.com.au]
AuthPass=[yourRealYahooPassword]
TLS_CA_File=~/cert.pem
Create the cert.pem file with OpenSSL. I used the command openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999 -nodes (more info here). You can stick the file anywhere, but I just chucked it in ~/. Wherever you put it, make sure you point the 'TLS_CA_File=' line in ssmtp.conf to the correct location.
Open the file /etc/ssmtp/revaliases and add the line [yourPCUsername]:[yourRealEmail@yahoo.com.au]:smtp.mail.yahoo.com:587. If you're running as root, I would think you need to add another line replacing you name with 'root'.
That's it, you're good to go! To test, the easiest way (IMO) is to create a file with the following in it:
To: [yourRealEmail@yahoo.com.au]
From: "whateverYaWant" <[yourRealEmail@yahoo.com.au]>
Subject: Some Notifying Email
MIME-Version: 1.0
Content-Type: text/plain
Body of your email goes here! Hello world!
Save and close the file, then (to check you don't have the real sendmail installed, run sendmail -V - it should say 'sSMTP') run cat fileWithEmailInIt.txt | sendmail -i -t. Then wait a few seconds (10-30) and check your email!
Obviously, replace [yourRealEmail@yahoo.com.au] with your email (without the brackets) and [yourRealYahooPassword] with your Yahoo Mail password (again, without the brackets).