How to send mails along with the attachement using script on Unix ?

Practically its very difficult for us to check the log file every time whenever the error messages occured.

This script will search specific messages from the log file and send it to the user whenever it finds specified messages.

-------------------------------------------------------------------------------------
#!/usr/bin/sh
grep -i "" "log file location" > /tmp/disassociate_on_delete_stg_AGG_P
SUBJECT="Error messages from the Log File"
EMAIL_ADDRESS=""
BODY="Error messages Occured"
if [ -s "/tmp/disassociate_on_delete_stg_AGG_P" ]
then
uuencode /tmp/disassociate_on_delete_stg_AGG_P /tmp/disassociate_on_delete_stg_AGG_P.txt; > /tmp/disassociate_on_delete_stg_AGG_P.txt
echo "$BODY" mailx -s "$SUBJECT" "$EMAIL_ADDRESS" < /tmp/disassociate_on_delete_stg_AGG_P.txt
else
echo "we are fine"
fi
--------------------------------------------------------------------------------------