I want to send an e-mail using mailx which has an attachment and HTML code on the body. Setting the Content-type to "text/html" mail comes with file binary content on the body instead of attached.
echo "" >> $MAILFILE
echo "<HTML>" >> $MAILFILE
echo "<HEAD>" >> $MAILFILE
echo "</HEAD>" >> $MAILFILE
echo "<BODY>" >> $MAILFILE
echo "<table border="1">" >>$MAILFILE
echo "<tr bgcolor=#C0C0C0>" >>$MAILFILE
echo "<td><b>OUTAGE</b></td>" >>$MAILFILE
echo "<td>$OUTAGE_COUNT</td>" >>$MAILFILE
echo "</tr> </table><br>" >>$MAILFILE
echo "</table>" >> $MAILFILE
echo "</BODY></HTML>" >> $MAILFILE
(uuencode outage.zip outage.zip;cat $MAILFILE) | mailx -s "Outage Payments Status
Content-type: text/html" $distro -- -f ${EMAIL_FROM}
Result - Body's email:
begin 644 outage.zip M4$L#!!0````(`,:$(T5RYN"0#P```.D#```3`!4`;W5T86=E7W!A>6UE;G1S M+F-S=E54"0`#)&X'5"1N!U15>`0`.GX1@5-0@`(3A5$P"D;!,`5<&%Y;65N=',N8W-V550%``,D;@=457@``%!+!08``````0`!`$X```!5 %```````` ` end