How to send emails in a bash script

Simple example to send an email if $message is not null

SUBJECT="Automated Security Alert" 
$message '' # if error or alert then create a message 
if [[ -n $message ]] 
 echo $message 
 /bin/mail -s "$SUBJECT" "$TO"

Justin Kelly

Justin Kelly

Data Engineeer, Business Analytics, Web Developer, Library Technology specialising in PHP and Tableau

Based in Melbourne, Australia

Feel free to contact me or _justin_kelly