Results 1 to 9 of 9
hi! i woult like to make a report, and send to my mail in html format.
I have this:
Code:
#!/bin/bash
echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">" ...
- 11-27-2008 #1Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
send a report in html format
hi! i woult like to make a report, and send to my mail in html format.
I have this:
why my browser don't put the text in the size and font correctly?Code:#!/bin/bash echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">" > /root/file.html echo "<html>" >> /root/file.html echo "<head>" >> /root/file.html echo "<meta content="text/html; charset=utf-8" http-equiv="Content-Type">" >> /root/file.html #echo "<title></title>" >> /root/file.html echo "<body>" >> /root/file.html echo "<FONT FACE="verdana" SIZE="2">" >> /root/file.html echo "SERVER:" `hostname` >> /root/file.html echo "</font>" >> /root/file.html echo "</body>" >> /root/file.html echo "</html>" >> /root/file.html echo "" | mail -s user_01@gmail.com < /root/file.html
Are any solution for my case?
thanks!
- 11-27-2008 #2Just Joined!
- Join Date
- Nov 2008
- Posts
- 11
Which browser?
BTW you haven't closed your head element. It *could* be the cause of the problem depending on the html renderer being used.
- 11-27-2008 #3Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
for example gmail or Lotus,....
- 11-27-2008 #4Just Joined!
- Join Date
- Nov 2008
- Posts
- 11
Lotus Notes is horrible for HTML emails but what you've got should probably work - still fix the head element though.
- 11-27-2008 #5Just Joined!
- Join Date
- Nov 2008
- Posts
- 11
More thoughts, when we do marketing emails (often to Lotus Notes as that's what my corporation uses), we tend to have best results using HTML 4 with *inline* styles.
So you could try
Code:echo "<body>" >> /root/file.html echo "<p style="font-family: Verdana; font-size: 11px">" >> /root/file.html echo "SERVER:" `hostname` >> /root/file.html echo "</p>" >> /root/file.html echo "</body>" >> /root/file.html
- 11-27-2008 #6Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
If i put:
the result in gmaill.com:Code:#!/bin/bash echo "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">" > /export/home/oper/prova.html echo "<html>" >> /export/home/oper/prova.html echo "<head>" >> /export/home/oper/prova.html echo "<meta content="text/html"; charset="utf-8" http-equiv="Content-Type">" >> /export/home/oper/prova.html echo "<p style=font-family: Verdana; font-size: 11px>" >> /export/home/oper/prova.html echo "SERVER:" `hostname` >> /export/home/oper/prova.html echo "</p>" >> /export/home/oper/prova.html echo "</body>" >> /export/home/oper/prova.html echo "</body>" >> /export/home/oper/prova.html echo "</html>" >> /export/home/oper/prova.html echo "" | mail -s user_01@gmail.com < /export/home/oper/prova.html
<!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/html4/loose.dtd>
<html>
<head>
<meta content=text/html; charset=utf-8 http-equiv=Content-Type>
<p style=font-family: Verdana; font-size: 11px>
SERVER: MYSERVER
</p>
</body>
</body>
</html>
but my result should be only:
SERVER: MYSERVER
- 11-27-2008 #7Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
Please read this: MIME (Multipurpose Internet Mail Extensions)
- 11-27-2008 #8Just Joined!
- Join Date
- Nov 2008
- Posts
- 11
I don't use shell script but do you need to escape the "s so that they show up?
E.g. it should read
style="font-family: Verdana; font-size: 11px"
meta content="text/html; charset=utf8"
etc.
- the quotes are important.
Also, you still need to close that head tag.
After outputing the meta element,
echo "</head>" >> /export/home/oper/prova.html
But if you're getting the fuill html source displayed like that then chances are the mail is not being sent with the correct content type headers etc.
The content type in the email header needs to be set to "text/html; charset="utf-8" to match the type listed in the HTML source.
I don't think you can do that with the mail command. You could try using sendmail instead - Linux, send html email from command line
- 11-27-2008 #9Just Joined!
- Join Date
- Oct 2008
- Posts
- 48
thanks for the links!


Reply With Quote