sSMTP On The Console
Sometimes you may need to send emails automatically from the command-line, for instance when a server is rebooted from your init.d scripts.
The following script/code will send out a formatted email using sSMTP (or sendmail):
#!/bin/bash CURDATE=`date` sendmail -oi user@domain.com << EOF From: Your User <user2@domain2.com> To: user@domain.com Subject: SERVER INFO: Booted on $CURDATE The server has just been booted on $CURDATE. EOF