Home » Infrastructure » Unix » Subject parameter in sendmail
Subject parameter in sendmail [message #98260] Wed, 02 June 2004 12:28 Go to next message
bheemsen aitha
Messages: 4
Registered: June 2004
Junior Member
Hi,

We are using the sendmail utility on our AIX box to send emails to our clients in our network. During the last one month it is NOT working properly. The problem is that the subject line coming as blank in the email.

We are using the following syntax for the past one year.

smartmail.sh <alias> <file to attach> <subject> | sendmail -t

The program smartmail.sh is below:

 

function formatheader
{
mailids=$(echo $mailid | sed 's/ /,/g')
print "to: $mailids
sub: $sub
content-type: text/html

" > $tmp
}

function formatbody
{
print "<html>
<body>
" >> $tmp
cat $fil >> $tmp
print "

</body>
</html>

" >> $tmp
}

function exitWithSplash
{
        print "usage : smartmail <alias> <file> <subject> "
        exit 1
}

####
# main sir
#####

if [[[[ $# -lt 3 ]]]]
then
        exitWithSplash
fi

usr=$1
fil=$2
sub=$3
tmp=/tmp/smartmail.$$
maildb=$HOME/.mailrc
rm -f $tmp

data=$(cat $maildb  | grep "^alias $usr ")
if [[[[ $? -ne 0 ]]]]
then
        print "Sorry no records found with alias $usr in $maildb"
        exit 1
fi

if [[[[ ! -f $fil ]]]]
then
        print "Sorry file $fil could not be opened .. exit status $?"
        exit 1
fi
echo $data &#124  while read a b mailid
do
        formatheader
        formatbody

done

cat $tmp

 

 

 

Can someone please help on what's wrong with our sendmail utility.

Thanx..

PS: The program smartmail.sh is working fine.

-Bheemsen

 

 

 

 

 
Re: Subject parameter in sendmail [message #98262 is a reply to message #98260] Sun, 06 June 2004 05:05 Go to previous messageGo to next message
Frank Naude
Messages: 4579
Registered: April 1998
Senior Member
Hi,

Your mail headers are wrong. Try to replace:

print "to: $mailids
sub: $sub


with...

print "To: $mailids
Subject: $sub


Best regards.

Frank
Re: Subject parameter in sendmail [message #98263 is a reply to message #98262] Tue, 08 June 2004 07:26 Go to previous message
bheemsen aitha
Messages: 4
Registered: June 2004
Junior Member
Thank you very much. It worked.
Previous Topic: Urgent
Next Topic: Patches required to install Oracle 8.1.7 on Unixware 7.0.0
Goto Forum:
  


Current Time: Fri Apr 19 10:58:43 CDT 2024