• Post Reply Bookmark Topic Watch Topic
  • New Topic

mailx - mail body with html tags not getting rendered  RSS feed

 
M K Rayapudi
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am using mailx utility to send email that have HTML tags, but the mail received is not rendering, instead it is showing HTML tags.

Can someone please help.

below is the content of file:
<html>
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"></head>

text


texttexttexttexttext
texttexttexttexttext
texttexttexttexttext
texttexttexttexttext
texttexttexttexttext

text


text


</html>

Thank you
 
Tim Holloway
Saloon Keeper
Posts: 18799
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you have to send the html document as an attachment. It needs to be MIME-encoded and the body of email was originally defined to be plain text.

It's good practice to provide both plain-text and HTML if you want to format email. A lot of us don't trust HTML email not to carry security exploits and thus have our mail readers set to display the text in preference to HTML.
 
Andrew Polansky
Ranch Hand
Posts: 310
18
Linux MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Tim said, you need to set MIME type for your message. The <meta> tag in your HTML does not set the mail MIME type.

You can set the proper header ( Content-Type: text/html ) by using the -a option, ie:


I do not know if using HTML as an attachment is necessary, but certainly it is a good practice, again as Tim said.
 
M K Rayapudi
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:I think you have to send the html document as an attachment. It needs to be MIME-encoded and the body of email was originally defined to be plain text.


Thanks a lot Tim & Adam
Tim, The approach you said is working, I mean html document as an attachment, plain text in body.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!