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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send html mail using mailx from script 1

Status
Not open for further replies.

Bootstrap

Technical User
Nov 9, 2001
12
US
I have a filespace monitoring script that places results to an html file. I would like to send this .html file so that it displays in the body of an email. This would be from HP11 to Outlook.

I previously used mailx to send a text file, now sending the html file just shows the contents of the file in the email body. Excerpt:( mailx -s &quot;DISKSPACE.SH -- `date`&quot; user@company.com < $EMAIL)

Any help is greatly appreciated.

Thanks in Advance.

Boot
 
Looking at an HTML format email in Outlook I see the following header, perhaps something like that is missing in your HTML page:

<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML><HEAD>

<META content=&quot;MSHTML 6.00.2800.1170&quot; name=GENERATOR>
<STYLE></STYLE>
</HEAD>

IBM Certified Confused - MQSeries
IBM Certified Flabbergasted - AIX 5 pSeries System Administration
MS Certified Windblows Rebooter
 
Bootstrap,

I'm not sure if this will help you any, but below is a sample script that I got recently from another post which will send the file as an attachment.

++++++++++++++++++++++++++++++++++++++++++++++

FILE=test.html
DEST=user@domain.com
NAME=user

( cat <<-MSGTXT
Hello ${NAME},

Please see the attached file ${FILE}.

Sincerely,

user

MSGTXT

# For executable files uncomment the line below.
#uuencode ${FILE} ${FILE}) | mailx -s &quot;File ${FILE} as of $(date)&quot; ${DEST}

cat ${FILE}) | mailx -s &quot;File ${FILE} as of $(date)&quot; ${DEST}

Thanks,

John [afro]
 
I think that you will have to use sendmail instead of mailx to send inline html, e.g....

#!/usr/bin/ksh

export MAILTO=&quot;recipient@mail.com&quot;
export CONTENT=&quot;/tmp/df.html&quot;
export SUBJECT=&quot;Disk Space Report&quot;
(
echo &quot;Subject: $SUBJECT&quot;
echo &quot;MIME-Version: 1.0&quot;
echo &quot;Content-Type: text/html&quot;
echo &quot;Content-Disposition: inline&quot;
cat $CONTENT
) | /usr/sbin/sendmail $MAILTO


 
Thanks for all the input. Ygor, that worked like a charm.

Boot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top