display HTML text in body using unix mailX ????

display HTML text in body using unix mailX ????Hello,

could any one tell me how to display text in html layout by sending a file using mailx command in unix.

i know to use mailx :

mailx -s "SUBJECT" user.name@domail.com < file_name.txt

instead of txt file i want to send html page and that page should display in html format.

Please help me with this.

Thanks,

SparanBlue

I imagine you would want to uuencode or MIME encode it.

Thanks a lot.

Hi

I read the thread, i am also facing the same problem, but issues is that I cant use sendmail here, i am supposed to use mailx only as sendmail is not available on the system on which i work. I'll be damn happy if anybody can help me out,
Thanx a lot

mailx does not have MIME facilities (at least in the general case). Do you have mutt or pine then?

Like it says in that thread, mailx uses something like sendmail behind the scenes to send off the mail, so maybe you have it after all. Look in /usr/sbin/sendmail and /usr/lib/sendmail as well; or if you have locate, try locate sendmail

uuencode file2 file2 >> tempfile

mailx -s "ATTACHMENT with TEXT" vg517@chrysler.com < tempfile

Try using the above example. hope this'll workout for you.

Thanks
Varun.:b:

It is actually possible, and easy to send email in html format.
Here is an example perl script to do just that.

Give that a shot.
:cool:

You don't really need Perl for that, either. And you should make sure there is an empty line between the headers and the body.

( cat <<HERE; cat /path/to/file.html) | sendmail -oi -t
From: sender@example.com
To: recipients@example.net
Subject: We hate you, so we send HTML instead of plain text
Mime-Version: 1.0
Content-type: text/html
Content-transfer-encoding: 8bit

HERE

You should properly have Mime-Version and Content-Transfer-Encoding headers as well as Content-Type. The issue of correct MIME transfer encoding is one of the many possible complexities which is simply ignored here (and one of the reasons simple shell scripts don't work well in the general case).

If your cat can combine standard input with a regular file, more power to you.

cat - /path/to/file.html <<HERE | sendmail -oi -t
...