CommandLineMail

Examples of sending email through a script on Linux.

Example 1

   1 #!/bin/sh
   2 CURRDATE=`date -u "+%Y-%m-%dT%H:%m:%S.%Z"`
   3 FILE=/tmp/reportx$CURRDATE.txt
   4 SUBJECT="Report subject"
   5 BODY="Report body ...."
   6 MAILDESTINATION="dest1@example.org dest2@example.org"
   7 /usr/bin/python /home/user/script.py > $FILE
   8 echo $BODY | /bin/mail -a $FILE -s "$SUBJECT" -- $MAILDESTINATION

CommandLineMail (last edited 2013-09-03 19:59:20 by 31)