edgarsuit / FreeNAS-Report

SMART & ZPool Status Report for FreeNAS
GNU General Public License v3.0
113 stars 45 forks source link

HTML breaks in FreeNAS11.3-U2 (was fine in U1) #13

Open bsodmike opened 4 years ago

bsodmike commented 4 years ago

The email shows markup, hmm. Will try digging into the script.

edgarsuit commented 4 years ago

Still working fine for me in 11.3-U2. Let me know what you find.

bsodmike commented 4 years ago

I can't see any obvious errors, but it seems in FreeNAS11.3-U2 each echo "" call is adding a <br> to each line of markup. This causes gmail not to interpret the markup as HTML -- but this is a guess.

One clue I'm working off is this; from the first part of your script, in FreeNAS11.3-U1 (and prior) gmail would render the output as 1-long line, example:

Subject: FREENAS-BACKUP: Status Report (Tue Apr 7 08:00:11 +0530 2020) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08jU534c0p

However, now in FreeNAS11.3-U2

Subject: FREENAS-BACKUP: Status Report (Sat Apr 11 22:18:52 +0530 2020)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08jU534c0p
<br><br>
<table style="border: 1px solid black; border-collapse: collapse;">
<tr><th colspan="10" style="text-align:center; font-size:20px; height:40px; font-family:courier;">ZPool Status Report Summary on server FREENAS-BACKUP</th></tr>
<tr>
bsodmike commented 4 years ago

Hey @edgarsuit any further ideas mate?

edgarsuit commented 4 years ago

Nope, like I said, it's working fine for me in 11.3-U2 and I haven't heard of any other users with similar issues. Did you upgrade to U2.1?

bsodmike commented 4 years ago

Not yet, still on FreeNAS11.3-U2. I'll try the U2.1 upgrade and see if that helps, thanks.

bsodmike commented 3 years ago

Hey @edgarsuit I noticed your script calls sendmail -t -oi < "$logfile" but that command isn't available in FreeNAS11.3-U2. I'm calling plain old 'mail'~, but that only parses the content as plain text. That's the issue.~

Update: I have one system (a) FreeBSD 11.3-RELEASE-p5 and another (b) FreeBSD 11.3-RELEASE-p14. In my version of the scripts I'm calling

### Send report ###
if [ -z "${email}" ]; then
  echo "No email address specified, information available in ${logfile}"
else
  mail -s "${subject}" < ${logfile} ${email}
  rm ${logfile}
fi

The p5 system sends mail just fine, it is received as HTML; the p14 system does not. I ran a test on the p14 system to obtain a hexdump of the log and the output is the same as that on the p5 system.