Unable to attach a .txt file or .log file to mail and mailx command

Hi,
I am trying to attach a .log file or .txt file to mail command to send an email once my ksh script executed. I am unable to use mutt command as it has been not installed and i am not supposed to install it. I have tried many ways by googling which has not helped me to succeed.

Here is my requirement,I need to run some 10 sql queries and result need to send in the email via attachment. I have Check.ksh and i am running this by using nohup command.

nohup Check.ksh > Valid_Check.log 2>&1 &

In Check.ksh

typeset var TO="name@domain.com";
typeset var SUB="Report";
typeset var BODY="Check Completed";
typeset var ATTACHMENT=${FILE_PATH}/Valid_Check.log

if [ -f "${ATTACHMENT}" ]; then 
echo "Log file exist";
else
echo "No Log File";
fi

uuencode Valid_Check.log Valid_Check.log | mail -s "${SUB}" "${BODY}" ${TO}

and tried the below as well

#mailx -s "${SUB}" "${TO}" "${BODY}" < ${FILE_PATH}/Valid_Check.log
#cat ${FILE_PATH}/Valid_Check.log | mailx -s "${SUBJECT}" "${TO}" "${BODY}";
uuencode Valid_Check.log Valid_Check.log | mail -s "${SUB}" "${BODY}" ${TO}

But getting an error like "Valid... User unknown"
Any inputs would be helpful or any other simple/easy approach?

Thanks,

Try mailx:

uuencode Valid_Check.log Valid_Check.log | mailx -s "${SUB} ${BODY}" ${TO}

Note the change in quotes.

:b: Thanks Jim, Its working now!

Hi Jim,

mailx 

command was working fine a week ago but i am not getting any email now in my inbox.

Any idea!? what could be the reason? As i don't see any error in log file.

Thanks.

Look in your syslog file - for example the sendmail daemon may not be running.

If you cannot see that sendmail processed the mail request, try restarting.

Thanks for the quick reply Jim. daemon is not running.