0

I have to print data of 2 tables ( which is output of sql query) one after another and send it in email ( using sendemail utility) of shell.

I have html code as below

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>"

output should look like

Expected

But in actual the output is different

Actual

How can i achieve the expected output?

Geeme
  • 395
  • 2
  • 6
  • 18

1 Answers1

0

The answer is in this post - New lines (\r\n) are not working in email body.

My issue in the original post is here

echo "</body></html>"
echo  "Some text here"
echo " "

Solution is:

echo "</body></html><BR><BR />"
echo  "Some text here<p>"
echo "<BR><BR />"
Geeme
  • 395
  • 2
  • 6
  • 18