Help with mailx, uuencode

Here's my code -

FILES="file1 file2 file3"
for File in ${FILES}; do
uuencode "${File}" "$(basename ${File}"
done | mailx email@id.com

This works as expected, meaning emailing the files as attachments but with null body. Now what I want is a way to have the Body list the files in order e.g.

file1
file2
file3

I tried to put "echo" inside the loop accomplish it but doesn't seem to help -

FILES="file1 file2 file3"
for File in ${FILES}; do
uuencode "${File}" "$(basename ${File}"
echo "${File}"
done | mailx email@id.com

Any suggestions?

#!/bin/ksh

for file in file[1-3]
do
        (echo "$file"; uuencode "$file" "$file" )

done | mailx -m -s "Subject" email@domain.com

I am new to UNIX and need help with sending an email with a .csv attachment. I'm running on Linux and my code is as follows:

 
(cat $msgfile1 | uuencode -m $extract) |mailx -r from_email@example.com -s "Waiver Report" -a $extract to_email@example.com

I get the email with the attachment but get the following garbage in the body of the email:

 
begin 644 /data/inform/projects/accelya/targetfiles/waiver_rpt.csv
`
end

I've successfully used similar code running on HP-UX (using the -m option) but am now running on Linux where the -m option is not valid for the mailx command. In place of this, I'm using the -m option with the uuencode command but still get the garbage in the email body. Does anyone know how to get rid of this?

uuencode $msgfile $extract |mailx -r from_email@example.com -s "Waiver Report" $extract to_email@example.com

Try that: a couple of changes
no -a for mailx + no -m for uuencode, no cat, no child process for uuencode

What email client are you using? Not all of them understand uuencode any more.

Jim, I tried your suggestion but got the same results...

---------- Post updated at 09:17 AM ---------- Previous update was at 09:15 AM ----------

Corona688, how do I determine the mail client on my server?

Not the server. It wouldn't care. Whatever program you view the email with.

I'm using Outlook 2007. I'm able to send/receive the file with no issues when I run my code from HU-UX.

---------- Post updated at 02:20 PM ---------- Previous update was at 02:01 PM ----------

I figured it out, my new code is as follows:

 
cat $msgfile1 |mailx -r from_email@example.com -s "Waiver Report" -a $extract to_email@example.com

I now get the attachment with no garbage in the email body.

You might be happier with a mail client that knows how to do the attach, like mutt?