• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

mailx - mail body with html tags not getting rendered

 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Saloon Keeper
Posts: 26020
186
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 310
18
MS IE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Don't MAKE me come back there with this tiny ad:
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic