Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send html from command line

Status
Not open for further replies.

jared71

MIS
Jul 2, 2001
58
0
0
US
Hello,

I'm using the Mail command on Red Hat 9 in a shell script to send out nightly reports. In these I want to provide a link to a reporting dir on a web server. What tool should I use to tell the Mail client that it should send this as html MIME? Just putting the html in a text file and cat'ing it doesn't work. i.e.:

cat template.html | Mail -s "test" me@somesite.com

thanks.

jared
 
You need to create an email message, and add a content-type header to it so that the client knows to interpret the message as html.

Try adding this at the top of your html template, with the regular email headers:
Code:
MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1

----
JBR
 
i think the mail command creates the header, so adding a second one just apperas as text in the message.

thanks.
 
fyi, it looks like i would need to use a program like METAMAIL to do this, though I found that my mail client performed the desired affect of parsing a url in a txt message and converting it to a link.

jared!
 
I use ximian evolution as email client. I sent me an email (as you post before) and it works! html page is well see in evolution.

 
It's got to be some debugging to do with your .html or something. I did this session using telnet:
Code:
[flugh@argle ~]$ telnet mail.argle.com 25
Trying 11.17.5.91...
Connected to mail.argle.com.
Escape character is '^]'.
220 argle.com ESMTP
from: flugh
502 unimplemented (#5.5.1)
mail from: flugh
250 ok
rcpt to: foo
250 ok
data
354 go ahead
MIME-Version: 1.0
Content-Type: text/html; charset=iso-8859-1
 
<html>
<body>
<a href=&quot;[URL unfurl="true"]http://www.flugh.com&quot;>Nothing[/URL] to see here</a>
</body>
</html>
.
250 ok 1075440257 qp 22962
quit
221 argle.com
Connection closed by foreign host.
I get a link in my email. You just need to find the place in your script to add the right header.

----
JBR
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top