Mailx attachment not getting attached.

Hi Friends,

Please help me with this problem.
I have a number of split files in a directory. each split files has pdf filenames in it. pdf files are also in the same directory.
I send a mail for each split files present in the directory with the pdf file mentioned in the file.
I have written a code which i have mentioned below.
it works fine but attachment is missing. please let me know where i went wrong.

cd /home/oracle                    
. ./oas1012.env      
cd /home/oracle/PO_REP   
for list in `ls split_*`
  do
typeset str="";
  echo $list
 ( cat $list | while read file
      do
   if [ -n "${str}" ]; 
  then
   str="$str; uuencode $file";
  else
   str="uuencode $file";
  fi
done 
echo $str
( eval ${str} ) | mailx -s"Mailx" balaji_devadoss@syntelinc.com <<-EOF
EOF
echo "mailled"
) 
echo "....................................."
done
echo "======End Mailling Suppliers======" >>${logfile}
exit 0

Please refer to this thread, it might help.

Thanks for the reply..

I read the post, But in my case if i remove
<<-EOF
EOF
at the end of mailx command, i am able to get mails with attachments.
But the problem is i have press CTRL+D everytime for the mail to get delivered.

Please give your suggestion.

You really don't need that EOF block. You can simply send an email with attachment using below syntax:-

uuencode $file $file | mailx -m -s "mailx" balaji_devadoss@syntelinc.com

I hope this helps.

---------- Post updated at 00:09 ---------- Previous update was at 00:04 ----------

for file in split_*
do
   uuencode $file $file | mailx -m -s "mailx" balaji_devadoss@syntelinc.com
done 

if i remove EOF, for each iteration in for loop its struck and i have to press CTRL+D everytime which i dont want to do since its a batch process.
Moreover if i remove EOF i am not getting any mails. thats the problem.

---------- Post updated at 04:33 AM ---------- Previous update was at 01:22 AM ----------

i used

echo | ( eval ${str} ) | mailx -s"Mailx" balaji_devadoss@syntelinc.com

its working now.. :slight_smile: