1748216 Members
3391 Online
108759 Solutions
New Discussion юеВ

Re: mailx, sendmail html

 
SOLVED
Go to solution
jason thompson_1
Frequent Advisor

mailx, sendmail html

Here is what we have, HPUX 10.20 and Sendmail 8.9.3.1. What we are trying to do is send the html source code to a Outlook 2000 client and have it display the page like a browser would. However all I can manage is to get the source code appear in the body. I have searched the forums but have been unable to find a soultion as of yet. Does anyone have some suggestions as how to remedy this?
What's that smell?
14 REPLIES 14
someone_4
Honored Contributor
Solution

Re: mailx, sendmail html

hi .. in your html page add this to the top above the html code

Content-Type: text/html

Look at the attached example.
The from and subject are optional.

Then

cat file.html | sendmail whoever@wherever.com

and it will get to your outlook 2000 client with the html inside of the body.

Richard

Steven E. Protter
Exalted Contributor

Re: mailx, sendmail html

If the html code can be put into a file, here is a reliable program that will send it as an attachment.

This is a tested, production script.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Seth Parker
Trusted Contributor

Re: mailx, sendmail html

I do something very similar to what Richard suggests. Below is a snippet of the script I use to send out HTML messages.

# Make the message header file
echo "Subject: This is my subject" > header.tmp
echo "Mime-Version: 1.0" >> header.tmp
echo "Content-Type: text/html; charset=usascii" >> header.tmp
echo >> header.tmp

# Cat the header and message file into sendmail and send it
cat header.tmp message.html | /usr/sbin/sendmail whomever@whereever.org

rm header.tmp

Looking at the script Steven posted, it seems that I could do without the MIME part, since there's no MIME encoding. Steven's script looks more full-service than the above, but I thought I'd post this because it's simple.

Steven, where does the HTML message get its content type set in your script? I see the multi-part divider, but I thought that each section needed to have its type defined within the section (this is from memory, so please forgive me if I'm wrong).

Good luck!
jason thompson_1
Frequent Advisor

Re: mailx, sendmail html

Thanks for the help folks.
What's that smell?
jason thompson_1
Frequent Advisor

Re: mailx, sendmail html

It works great with Sendmail, but not with Mailx. Is there a way to force the content type on Mailx from text/plain to text/html?
What's that smell?
someone_4
Honored Contributor

Re: mailx, sendmail html

hi for mailx try

uuencode index.html index.html | mailx -s "your subject" whoever@wherever.com

your index.html file does not have to have the Content-Type: text/html.



Richard
jason thompson_1
Frequent Advisor

Re: mailx, sendmail html

That seems to work however, it sends the file as an attachment. For our purposes we want the file displayed within the body of the message.
What's that smell?
Seth Parker
Trusted Contributor

Re: mailx, sendmail html

I originally tried the mailx way too, but I could never get it to work. Mailx puts the message headers *above* whatever you have as your message text, so the content type gets lost. Sendmail just sends the input (or that was what I determined from the research and experimentation I did).

Mailx clobbers whaterver you try to do to make it not just be a text message, so I think you're going to be stuck with the sendmail method.

Do some experimentation. I sent many messages to myself and examined the actual message text (not the rendered version) to see what was happening.

Good luck!
someone_4
Honored Contributor

Re: mailx, sendmail html

hi ..
yes it does send it as an attachment but the attachment is also in the body of the email if you open the email and not just look at it through the preview window.

Richard