Hi All,
I have written a script that sends an automated email from the Unix LAN to my mail address on my pc. The only thing I want it to do that I can't find is put information in the subject header. I am using sendmail. I tried using mailx but that did not work. mailx has the switch -s for subject, but sendmail does not. Am I right in thinking that you should only send preformatted mails with sendmail or is there a switch that I am missing?
Here is the script to understand things a little better
#!/bin/csh
#set echo
if (! -e /dmps/state ) then
touch /dmps/state
else
rm /dmps/state
touch /dmps/state
endif
df -tk /dmps > /dmps/state
set size = `cat /dmps/state | grep "[0-9]%"`
set size = `echo $size | cut -f5 -d' '`
set size = `echo $size | cut -f1 -d'%'`
if ( $size >= 70 ) then
echo "/DMPS IS AT "$size"% PLEASE ATTEND TO THIS IMMEDIATELY " > /dmps/state
echo "Date: "date >> /dmps/state
######## NEED SUBJECT SWITCH FOR BELOW! ############
/usr/lib/sendmail -f administrator -v mjames@bmjgroup.com < /dmps/state
###########################################
else
echo "No worries, /dmps is at "$size"% " > /dmps/state | date >> /dmps/state
endif
Cheers!
Jimbo
I have written a script that sends an automated email from the Unix LAN to my mail address on my pc. The only thing I want it to do that I can't find is put information in the subject header. I am using sendmail. I tried using mailx but that did not work. mailx has the switch -s for subject, but sendmail does not. Am I right in thinking that you should only send preformatted mails with sendmail or is there a switch that I am missing?
Here is the script to understand things a little better
#!/bin/csh
#set echo
if (! -e /dmps/state ) then
touch /dmps/state
else
rm /dmps/state
touch /dmps/state
endif
df -tk /dmps > /dmps/state
set size = `cat /dmps/state | grep "[0-9]%"`
set size = `echo $size | cut -f5 -d' '`
set size = `echo $size | cut -f1 -d'%'`
if ( $size >= 70 ) then
echo "/DMPS IS AT "$size"% PLEASE ATTEND TO THIS IMMEDIATELY " > /dmps/state
echo "Date: "date >> /dmps/state
######## NEED SUBJECT SWITCH FOR BELOW! ############
/usr/lib/sendmail -f administrator -v mjames@bmjgroup.com < /dmps/state
###########################################
else
echo "No worries, /dmps is at "$size"% " > /dmps/state | date >> /dmps/state
endif
Cheers!
Jimbo