The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Mail issue - Subject title missing kiem SUN Solaris 2 10-10-2007 11:56 AM
what are the codes used for setting the subject in the mail command? Jason3107 UNIX for Dummies Questions & Answers 2 07-12-2007 06:15 AM
sort mail based on subject in unix. sriram.s Shell Programming and Scripting 2 02-02-2007 04:38 AM
How to set Subject in 'mail' ? hkapil UNIX for Dummies Questions & Answers 2 10-14-2005 01:36 PM
Send a mail with a subject and an attachement josecollantes UNIX for Dummies Questions & Answers 1 08-27-2001 08:55 PM

Closed Thread
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 11-29-2001
Registered User
 

Join Date: Nov 2001
Location: Hull - UK
Posts: 5
Mail subject output of script

I am new to this site so please bear with my ignorances.

I have started playing with mail on AIX 4.3.3 with many successes (thanks to this site) but am now stuck.

I want to send a mail with the subject as the result of a script, eg. I want the mail body to read as the output from 'df -k /......' - this is sheer laziness but it would save my collegeues reading the mail when the results are in the subject header - hope this makes sense.

I have tried calling variables in the mail -s ".....${}" without success.

Regards

Kiano
Forum Sponsor
  #2  
Old 11-29-2001
ghoti's Avatar
Registered User
 

Join Date: Jul 2001
Location: Wales
Posts: 55
I don't know if this is of any help, but I had the same problem with getting 'mail' to run from within a script, and I had to resort to using sendmail.

below is an example of how I used it.
Code:
#!/bin/bash
TO="me@xxx.com"
CC=""
FROM="someone_else@xxx.com"
SUBJECT="This is a test"

/usr/sbin/sendmail -t <<-EOF
To: $TO
Subject: $SUBJECT
        Hello,
        Body goes here. 
        regards,
        your script

EOF
echo "Done....!="
I hope this helps a bit..
-gHoTi
__________________
regards,

-ghoti
  #3  
Old 11-29-2001
Registered User
 

Join Date: Nov 2001
Location: Hull - UK
Posts: 5
Thanks ghoti

It think i relayed my request incorrectly.

I need the subject to be the output of a script,

mail -s "output from my script"

Thanks in advance

Kiano
  #4  
Old 11-29-2001
ghoti's Avatar
Registered User
 

Join Date: Jul 2001
Location: Wales
Posts: 55
I know what you said, and I think you can do it using this.

Simply assign the output of your script to the variable SUBJECT / $SUBJECT in the above example and away you go....

I only put all the rest in there as it was the way I used it and shows most of the settings, which could be helpful fo rother solutions as well....
__________________
regards,

-ghoti
  #5  
Old 11-29-2001
Registered User
 

Join Date: Nov 2001
Location: Hull - UK
Posts: 5
You're right!

Thanks very much for your help


Kiano
Google The UNIX and Linux Forums
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 03:56 AM.


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 Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0