sending an attachment through email

As a part of requirement I need to send out mails with attachment from UNIX. I have to take query the Oracle DB and send the result of the query in an attachment through mail.

I use the following script for the same.

#!/bin/csh
#!/bin/bash
#!/bin/ksh
ATTFILE=/folder1/test.xls
cd /opt/oracle/lin-10.1.0.4/bin
sqlplus userid/pwd@DVMRM @/folder1/test.sql
uuencode $ATTFILE $ATTFILE | mailx -s "Attachment" aa@yy.com

But the uuencode command is not recognized and I get the following error:
uuencode: command not found

what should be done to do away with this?

Suggest, that perhaps this is a path issue ...
try - 'which uuencode' - to find out where uuencode is located on your machine.
In my case returns - /usr/bin/uuencode
Then can change your line to (in my case) -

/usr/bin/uuencode $ATTFILE $ATTFILE | mailx -s "Attachment" aa@yy.com

or

ensure /usr/bin is in your $PATH.

Hope this helps.:slight_smile: