Problem in sending mail with attachment

Hi Team,

I have written the following code snippet to send mail with attachment to recipient. But I am getting mail with attachment. But the file is empty. All the 3 Attachment* size is more than 80KB.

Not sure what is wrong in the command.

MSG_BODY1="hi"
LOG_FILE="a/b/c/log1.log"
Attachment1="a/b/c/attach1.rej"
Attachment2="a/b/c/attach2.rej"
Attachment3='a/b/c/attach3.rej"
echo "${MSG_BODY1}" > email | ($Attachment1;$Attachment2;$Attachment3) | cat email - | mailx -s "hi" "abd@kkk.com >> $LOG_FILE

Can anyone help me to fix the issue?

Thanks
Krishnakanth

try this:

# specify list of email recipients all dummy names, replace them
recipients="somebody@my.com john@his.com"
# specify envelope sender address  dummy name
attachments="file1.csv anotherfile.txt lastfile.txt"

sender=me@mycompany.com
( 
  echo 'here are some attachments for you'
  for i in $attachments 
  do
    uuencode $i $i
  done
) | sendmail -f"$sender" -i -- $recipients

No quotes around $recipients

Perfect Jim. Thanks.

But where can i give the mail subject.

can you send me the code snippet as well.

Thanks
Krishnakanth Manivannan