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@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
From: Sven Aluoor aluoor@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 text
Not sure about outlook but the following works for me and tbird: Add "Content-type: text/html" at the begining...
JD
On Thu, Oct 21, 2010 at 6:12 PM, John Doe jdmls@yahoo.com wrote:
Not sure about outlook but the following works for me and tbird: Add "Content-type: text/html" at the begining...
This doesn't work with M$ Outlook. I receive a plain text mail with the contents:
Content-type: text/html <p> <table border='1' width='90%' align='center' summary='Script output'> <tr> <td align="right"> 15361753 </td> <td> [...]
any other idea?
cheers Sven
From: Sven Aluoor aluoor@gmail.com
On Thu, Oct 21, 2010 at 6:12 PM, John Doe jdmls@yahoo.com wrote:
Not sure about outlook but the following works for me and tbird: Add "Content-type: text/html" at the begining...
This doesn't work with M$ Outlook. I receive a plain text mail with the contents:
This does not work for me either... with mailx... but with sendmail, it works.
$ cat <<EOF | /usr/sbin/sendmail -t Subject: test to: jd@example.com Content-type: text/html <p> <table border='1' width='90%' align='center' summary='Script output'> <tr><td align="right">15361753</td></tr> </table> EOF
JD
On 10/25/10 1:07 AM, Sven Aluoor wrote:
On Thu, Oct 21, 2010 at 6:12 PM, John Doejdmls@yahoo.com wrote:
Not sure about outlook but the following works for me and tbird: Add "Content-type: text/html" at the begining...
This doesn't work with M$ Outlook. I receive a plain text mail with the contents:
Content-type: text/html
<p> <table border='1' width='90%' align='center' summary='Script output'> <tr> <td align="right"> 15361753 </td> <td> [...]
any other idea?
the Content-type: has to be part of the message HEADER, not the message BODY. they are separated by a blank line. afaik, you can't modify the header generated by mailx, instead, you need to use the sendmail command, and create the whole header yourself.
On Thu, Oct 21, 2010 at 6:40 AM, Sven Aluoor aluoor@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 text
The 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@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.
On Mon, Oct 25, 2010 at 5:16 PM, Bart Schaefer barton.schaefer@gmail.com wrote:
The 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@ubs.com < /tmp/coi.html
Thanks you Bart. Works very well :-)
If that doesn't work, you're going to have to avoid using mailx and construct the message header yourself.
I am just curious (I have my solution): what are alternatives for sending mails on Linux command line?
cheers Sven
On 10/25/2010 08:31 AM, Sven Aluoor wrote:
I am just curious (I have my solution): what are alternatives for sending mails on Linux command line?
Perl works well (especially if you want to do things like make HTML mails correctly).
Here is a walk through for doing it:
http://www.revsys.com/writings/perl/sending-email-with-perl.html
At the other end of sophistication, you can just pipe it right into sendmail:
http://www.perlfect.com/articles/sendmail.shtml
On Mon, 2010-10-25 at 17:31 +0200, Sven Aluoor wrote:
what are alternatives for sending mails on Linux command line?
http://www.cleancode.org/downloads/email/