Hi,
I have a .sh file, to email a report of our backups from a linux machine. It looks like this (minus a few bits):
echo "HELO $host.$domain"
sleep 1
echo "mail from: vdrreport@$domain"
sleep 1
echo "rcpt to:$mailto"
sleep 1
echo "data"
sleep 1
echo "subject: $host VDR-Report $(date +"%Y.%m.%d %H:%M")"
sleep 1
echo "from: "vdrreport@$domain
sleep 1
echo "to:$mailto"
sleep 1
echo "Mime-Version: 1.0;"
sleep 1
echo "Content-Type: text/html; charset="ISO-8859-1";"
sleep 1
echo "Content-Transfer-Encoding: 7bit;"
sleep 1
sleep 1
echo "##### Backup overview ($succ successfull jobs) #####"
sleep 1
echo "<p> "
sleep 1
if [ -f /root/oldbackup.out ]
then
cat grep "Task completed" /root/oldbackup.out | grep $today
else
echo No list for backups found!
fi
sleep 1
echo "<p/>"
sleep 1
echo " "
sleep 1
echo "."
sleep 1
echo "QUIT"
) | telnet $smtphost.$domain 25
This sends a html email, but without any formatting for the log file that has been cat out.
##### Backup overview (57 successfull jobs) #####
1/11/2013 12:01:52 AM: Performing incremental back up of disk Productci/Productci-flat.vmdk 1/11/2013 12:07:26 AM: Removed snapshot_datarecovery_ 1/11/2013 12:07:26 AM: Task completed successfully 1/11/2013 12:07:26 AM: Completed: 5 files, 25.1 GB 1/11/2013 12:07:26 AM: Performance: 4585.0 MB/minute 1/11/2013 12:07:26 AM: Duration: 00:07:18 (00:01:43 idle/loading/preparing) 1/11/2013 12:01:07 AM: Performing incremental back up of disk tflcrowndev1/tflcrowndev1-000002-flat.vmdk 1/11/2013 12:09:21 AM: Removed snapshot_datarecovery_ 1/11/2013 12:09:21 AM: Task completed successfully
If i just send it as plain text, it appears fine:
11/28/2012 4:01:44 PM: Starting incremental integrity check
11/28/2012 4:04:10 PM: Task completed successfully
11/29/2012 4:24:35 PM: Starting incremental integrity check
11/29/2012 4:27:45 PM: Task completed successfully
Can i get my email to send as html and keep the same formatting as plain text?
Cheers.