The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sending mail from unix anki_1 UNIX for Dummies Questions & Answers 3 04-09-2008 01:03 PM
Unix:mail sending issue..pls help me soon bobprabhu UNIX for Dummies Questions & Answers 2 02-01-2008 01:44 AM
Sending mail in C/C++ in unix server electroon High Level Programming 6 01-21-2008 07:58 AM
Sending mail thu unix hellotosatish UNIX for Dummies Questions & Answers 6 09-15-2007 06:46 PM
sending mail with html content gmchoudary UNIX for Dummies Questions & Answers 2 11-28-2005 04:26 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-04-2005
Registered User
 

Join Date: Aug 2003
Location: Ireland
Posts: 269
Sending mail from Unix - For html output

I have automated some checks - and I want to send a email when there is an issue.
This is fine and I can send the email.

However - I want to generate the email in html format so I can highlight any issues to a reader..
ie. If there is a disk space issue - then the email will highlight the problem in red or bold etc...

I have tried sending the html tags in a file via email - but the receiver simply gets an email with the contents of the file including html tags all in black which is no use because it doesnt highlight the problem found.

Any ideas?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-04-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,453
You need to use a user agent that is mime aware and supports html. Or you need to write one. Here is a quick and dirty script that just worked for me...
Code:
#! /usr/bin/ksh
MTA=/usr/lib/sendmail
VERSION=1.0

{
echo "From: jdoe <John Doe>"
echo "To: tom.jones@whatever.com <tom jones>"
echo "Subject: test 2"
echo "X-Mailer: htmlmail" $VERSION
echo "Mime-Version: 1.0"
echo "Content-Type: text/html; charset=US-ASCII"
echo
echo "<center> <h1> Test Center Heading </h1> </center>"
echo "<p> This is some text.  And so is this. </p>"

} | eval $MTA "tom.jones@whatever.com"

exit 0

Last edited by Perderabo; 05-04-2005 at 01:19 PM.
Reply With Quote
  #3 (permalink)  
Old 05-04-2005
Registered User
 

Join Date: Aug 2003
Location: Ireland
Posts: 269
Excellent!! Got me out of a hole.

Thanks for your help!
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0