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 and shell scripting languages 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 05:03 PM
Unix:mail sending issue..pls help me soon bobprabhu UNIX for Dummies Questions & Answers 2 02-01-2008 05:44 AM
Sending mail in C/C++ in unix server electroon High Level Programming 6 01-21-2008 11:58 AM
Sending mail thu unix hellotosatish UNIX for Dummies Questions & Answers 6 09-15-2007 10:46 PM
sending mail with html content gmchoudary UNIX for Dummies Questions & Answers 2 11-28-2005 08:26 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-04-2005
frustrated1 frustrated1 is offline
Registered User
  
 

Join Date: Aug 2003
Location: Ireland
Posts: 278
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?
  #2 (permalink)  
Old 05-04-2005
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,126
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 05:19 PM..
  #3 (permalink)  
Old 05-04-2005
frustrated1 frustrated1 is offline
Registered User
  
 

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

Thanks for your help!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0