我必须打印2个表的数据(这是sql查询的输出)一个接一个,并在shell的电子邮件中发送(使用sendemail实用程序)。
我有如下的html代码
echo "MIME-Version: 1.0"
#echo "Content-Type: multipart/alternative; "
echo "Content-Type: multipart/mixed;"
echo ' boundary="some.unique.value.ABC123/server.xyz.com"'
echo "Subject: "
echo ""
echo "This is a MIME-encapsulated message"
echo ""
echo "--some.unique.value.ABC123/server.xyz.com"
echo "Content-Type: text/html"
echo ""
echo "<html> <head> <style>table, th, td { border: 0.5px solid black;}</style><title>Some Title</title></head><body><table style=\"width:100%\" >"
echo "<tr><th>Col1</th><th>Col2/th><th>Col3</th><th>Col4</th></tr>"
cat mailbody
echo " "
echo "</body></html>"
echo "Some text here"
echo " "
echo "<html> <head> <style>table, th, td { border: 0.5px solid black;}</style><title>Some Title</title></head><body><table style=\"width:100%\" >"
echo "<tr><th>Col1</th><th>Col2/th><th>Col3</th><th>Col4</th></tr>"
cat mailbody2
echo " "
echo "</body></html>"
输出应类似于
但实际上输出是不同的
我怎样才能达到预期的产出?
1条答案
按热度按时间km0tfn4u1#
答案就在这篇文章中-New lines (\r\n) are not working in email body。
我的问题在原来的职位是在这里
解决方案是: