I am doing a MySQL database backup script and I would like it to report to me via e-mail.
So far I was able to make it to have a subject and a body without attachment. Code:
cat << EOF | mail -s "MySQL backups for $(date +%d.%m.%Y\ %H:%M)" mymail@mydomain.com
'text in the body'
text outside of the quotes
$value
EOF
Also separately than the above, I was able to make it to send e-mail with subject and attachment, but without body. Code:
gzip -c test.sh | uuencode test.sh.gz | mail -s "MySQL backups for $(date +%d.%m.%Y\ %H:%M)" mymail@mydomain.com
When I try to combine them as below, I am receiving an e-mail with an empty body.
cat << EOF | gzip -c test.sh | uuencode test.sh.gz | mail -s "MySQL backups for $(date +%d.%m.%Y\ %H:%M)" mymail@mydomain.com
'text in the body'
text outside of the quotes
$value
EOF