Thanks to everyone who replied. What happened to my Linux is my root user told me that I need a reboot. After the reboot, then my email with attachment works. Here's my code with a subject, body, and an attachment:
#!/bin/bash
FILE=$1
RECIPIENT=myemail@yahoo.com
(echo "This file $FILE was sent from Linux."
for i in `ls -1 $FILE`
do
file_name=`basename $i`
uuencode $i $file_name
done
) | mail -s "Mail sent with the attachment file: $FILE" "$RECIPIENT"
To use this script, just type in the name of the script followed by the filename. I thought I'd share this because I had a hard time getting to this point
This thread is closed.