So I know how to use the mail command to send mail through ssh, as in typing mail -s "Subject here" [email protected]
, then typing out the message, hitting CTRL + D to stop composing, then press enter to not have a Cc.
How I'm curious, how would I send an email through a non-interactive shell script? Just so I can send an email if a backup decided to fail, or whatever reason.
Thanks a bunch!
Well, just pipe in the content. eg
I do it like this:
You can use shell variables in the message. You can also add CC and BCC lines as desired.