Sendmail with attachment from Shell Script

Create a .sh file and add below code

cd /var/log/httpd/
tar -zcvf error_log.tar.gz error_log
echo “Message in Mail Body” | mutt -a “/var/log/httpd/error_log.tar.gz” -s “Error Logs Subject Line” — [email protected] [email protected]
rm -rf niticentral-error_log.tar.gz

Comments are closed.