Sven Aluoor
2010-Oct-21 13:40 UTC
[CentOS] send HTML formatted mail (for M$ Outlook) with mailx
Hi folks I have here a small ksh script which generates html output and I am trying to send this html output as inline HTML mail for M$ Outlook users (not attachment). But it doesn't work, in mail you see the html source as plain text [....] echo '<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">' > /tmp/coi.html echo "<head>" >> /tmp/coi.html echo "META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">" >> /tmp/coi.html echo "</head>" >> /tmp/coi.html echo "<body>" >> /tmp/coi.html generate_output_xen echo "</body>" >> /tmp/coi.html (cat /tmp/coi.html) | mailx -s "Test HTML output in outlook" sven.aluoor at ubs.com the procedure generate_output_xen have the output <p> <table border='1' width='90%' align='center' summary='Script output'> <tr> <td align="right"> 3w4535345 </td> <td> Banc335 </td> <td> SYS5 </td> <td> content </td> <td> 20-Oct-2010 14 :55 :04 [....] cheers Sven
John Doe
2010-Oct-21 16:12 UTC
[CentOS] send HTML formatted mail (for M$ Outlook) with mailx
From: Sven Aluoor <aluoor at gmail.com>> I have here a small ksh script which generates html output and I am > trying to send this html output as inline HTML mail for M$ Outlook > users (not attachment). > But it doesn't work, in mail you see the html source as plain textNot sure about outlook but the following works for me and tbird: Add "Content-type: text/html" at the begining... JD
Bart Schaefer
2010-Oct-25 15:16 UTC
[CentOS] send HTML formatted mail (for M$ Outlook) with mailx
On Thu, Oct 21, 2010 at 6:40 AM, Sven Aluoor <aluoor at gmail.com> wrote:> > I have here a small ksh script which generates html output and I am > trying to send this html output as inline HTML mail for M$ Outlook > users (not attachment). > > But it doesn't work, in mail you see the html source as plain textThe trouble here is that to have it properly rendered as HTML on receipt, it has to be tagged as HTML in the *headers* of the message. In your example, the headers are created by mailx, which is a very old interface that doesn't know how to apply the appropriate tagging. You may be able to fool it by doing this (note placement of newlines is important, also removed unnecessary use of cat and subshell): mailx -s "Test HTML output in outlook MIME-Version: 1.0 Content-Type: text/html" sven.aluoor at ubs.com < /tmp/coi.html If that doesn't work, you're going to have to avoid using mailx and construct the message header yourself.