monika
1
hi,
I have tried this code to send mail.Its not giving me error but I am not receiving mail also.Is there any config file that needs to be set.
#!/bin/ksh
echo "The first mail" >msg
cnt=`cat /dir1/msg | wc -l`
if [ $cnt -ne '0' ]
then
mail -s "Hello" abc.xyz@domain.com < msg
fi
I have also tried with the command
mailx -s "hello" abc.xyz@domain.come
ven this is not working.
Do any one have any idea how to get through this.
Try using a here-document, e,g,
mail -s "Hello" abc.xyz@domain.com << END
Your message here
END
If you want the message to come from the file, you can slurp it into a shell variable.
message=`cat message_file`
mail -s "Hello" abc.xyz@domain.com << END
$message
END
Finally you can pipe text to mail
echo "Your message here"|mail -s "Hello" abc.xyz@domain.com
cat message_file| mail -s "Hello" abc.xyz@domain.com
And by the way, note that you don't need the cat and pipe to count the lines in the file:
cnt=`wc -l /dir1/msg `
will do.