Wednesday, September 26, 2012

Sending Email From A Bash Script

#!/bin/bash
CONTENT="This is the content"
SUBJECT="This is the subject"
TO_ADDRESS=destination_email_address_here
FROM_ADDRESS=source_email_address_here

echo $CONTENT | mail -s $SUBJECT $TO_ADDRESS -- -r $FROM_ADDRESS
Note:
The -- delimits that the options following it are piped to sendmail