我想将矩阵的数据存储在html文件中并在outlook中发送电子邮件,我的代码如下:
printf "<!DOCTYPE html>"
printf "<html>"
printf "<head>"
printf "<style>"
printf "</style>"
printf "</head>"
printf "<body>"
printf "<table>"
printf "<tr>"
printf "<th>Total</th>"
printf "<th>StillFail</th>"
printf "<th>Pass</th>"
printf "<th>ScriptError</th>"
printf "<th>APIName</th>"
printf "</tr>"
printf "<tr>"
echo
for ((j=1;j<=num_rows;j++)) do
printf "<tr>"
for ((i=1;i<=num_columns;i++)) do
printf "<td>"
printf "${matrix[$j,$i]}"
printf "</td>"
printf "</tr>"
done
echo
done
printf "</tr>"
printf "</table>"
printf "</body>"
printf "</html>"
#mailx -a 'Content-Type: html' -s "my subject" test@example.com < output.html
mailx -s "TESTING MAIL"</home/test/example/output.html "test@example.com"
对应此代码的
我希望我的输出作为一个良好对齐的表。有人可以帮我吗? TIA
答案 0 :(得分:0)
您需要在标题中添加内容类型,可以使用mingw32
评论你的最后一行并试试这个
mailx
修改:
根据OP End错误:
mailx -a 'Content-Type: text/html' -s "Test MAIL" test@example.com</home/test/example/output.html
在mac 中安装content-type:texthtml no such file or
directory
mailutils
答案 1 :(得分:0)
也许你可以将它用作基础:
( echo "To: ADRESSES" echo "Subject: SUBJECT" echo "Content-Type: text/html" echo echo "HTML code" ) | /usr/sbin/sendmail -F "NameOfSender" -t