MAILX on an AIX server with arguments
- From: "DanceRat" <kimberly.shaffer@xxxxxxxxx>
- Date: 25 Sep 2006 16:54:22 -0700
I'm having the darndest time with this but it seems like it would be a
simple thing I'm missing...
Basically, what I'm trying to do is have my cake and eat it too - if
there isn't a file for the body, (no mfile exists), then I want it to
just put whatever is typed out in argument #1 as the bodyfile - for
instance, I type in "this is a test" for the $1 argument and when it
sees that there isn't a file called "this is a test" it actually just
uses that string as the body.
Anyone have any ideas?
#!/bin/sh
# MAILX.SH - generic shell to perform mailx with attachments.
# requires module defined with 5 arguments
# 1 filename to use as e-mail body (needs fully qualified pathname).
# 2 filename to use as e-mail attachment (needs fully qualified
pathname).
# 3 subject line of e-mail.
# 4 space delimited e-mail "to" list
# 5 space delimited distribution lists (needs fully qualified
pathname).
mfile=$1
afile=$2
msubj=\'$3\'
mto=\'$4\'
catfiles=$5
command='mailx'
if [ "$afile" != "''" ]; then
cat "$mfile" > $afile.uu
uuencode $afile $afile >> $afile.uu
else
cat "Sorry, there were no attachments." > $afile.uu
fi
if [ "$msubj" != "''" ]; then
command=$command' -s '$msubj
else
command=$command' -s "E-Mail For You"'
fi
if [ "$mto" = "''" ]; then
command=$command' '`cat $catfiles`' < '$afile.uu
else
command=$command' '$mto' < '$afile.uu
echo $PWD
fi
err=$?
echo $command
eval $command
rm $afile.uu
err=$?
exit $err
.
- Follow-Ups:
- Re: MAILX on an AIX server with arguments
- From: Bill Marcum
- Re: MAILX on an AIX server with arguments
- From: Scott McMillan
- Re: MAILX on an AIX server with arguments
- Prev by Date: Re: capture output of an ldapmodify command
- Next by Date: Re: The number of Network Adapters(NIC)
- Previous by thread: A simple SuSe Linux user spot checks, user account info collector, bash.
- Next by thread: Re: MAILX on an AIX server with arguments
- Index(es):
Relevant Pages
|