Tenho as seguintes linhas no final do meu script de backup para enviar e-mails com o log coletado antes.
mailbody=${log}
echo "From: Backup xx <[email protected]>" > /tmp/backupmail
echo "To: [email protected]" >> /tmp/backupmail
echo "Subject: [BACKUP] Failure report for $(hostname)" >> /tmp/backupmail
echo "" >> /tmp/backupmail
cat ${mailbody} >> /tmp/backupmail
cat /tmp/backupmail | /usr/sbin/sendmail -t