Tuesday, 26 August 2014

Sample mail script to attach files to auto generated mails

#!/usr/bin/ksh
df -h > /scripts/df.txt
export MAILTO="chittibabu.miriyala@gmail.com"
export CONTENT="/scripts/df.txt"
export SUBJECT="sending files example "
(
 echo "Subject: $SUBJECT"
 echo "MIME-Version: 1.0"
 echo "Content-Type: text/plain"
 echo "Content-Disposition:attachment; filename=df_output.txt"
 cat $CONTENT
) | sendmail -f yyy@gmail.com $MAILTO

No comments:

Post a Comment