-1

I am using sendmail to mail a zipped file as an attachment which consists of text files to my ID.As soon as I try to unzip this zipped file from my mail it shows INVALID ARCHIEVE DIRECTORY.Please help me out.

#!/bin/bash
BOUNDARY="=== This is the boundary between parts of the message. ==="        
ZIPFILE="textfile.tar.gz"        
ZIPFILENAME="/loc/textfile.tar.gz"       
export BODY="/loc/1.html"     
{        
   echo  "From: b@b.com"        
   echo  "To: a@a.com"        
   echo  "Subject:" $SUBJECT                
   echo  "MIME-Version: 1.0"        

   echo  "Content-Type: MULTIPART/MIXED; "        
   echo  "    BOUNDARY="\"q1w2e3r4t5\"     
   echo        
   echo  "This message is in MIME format.  But if you can see this,"    
   echo  "you aren't using a MIME aware mail program.  You shouldn't "    
   echo  "have too many problems because this message is entirely in"       
   echo  "ASCII and is designed to be somewhat readable with old "        
   echo  "mail software."        
   echo  "--q1w2e3r4t5"     
   echo  "Content-Type: TEXT/HTML; charset=US-ASCII"        
   echo '---q1w2e3r4t5'     
   echo "Content-Type: text/html"        
   echo "Content-Disposition: inline"        
   cat $BODY        
   echo  "This email comes with multiple attachments."        
   echo  "--q1w2e3r4t5"        
   echo  "Content-Type: application/zip; charset=US-ASCII; name="${ZIPFILE}      
   echo  "Content-Disposition: attachment;   filename="`basename ${ZIPFILE}`        
   echo        
   uuencode $ZIPFILE $ZIPFILE        
   echo  "--q1w2e3r4t5--"        
} | /usr/lib/sendmail -t                
Manu
  • 1
  • 4
  • do you have a `/loc/` dir on the machine you are unziping the file on? Good luck. – shellter Feb 27 '12 at 17:02
  • i am saving the file on desktop and then unzipping it. – Manu Mar 01 '12 at 07:00
  • I'm guessing that zip wants to put the file in the same dir that it found it, unless you use the zip arg that specifies 'ignore directory' . For 7z, that would the `-e` option OR you can make the `/loc/` dir on your machine. Good luck. – shellter Mar 01 '12 at 08:38

1 Answers1

0

You probably mean uuencode $ZIPFILENAME $ZIPFILE instead of uuencode $ZIPFILE $ZIPFILE?

Kimvais
  • 38,306
  • 16
  • 108
  • 142
  • i have tried uuencode $ZIPFILENAME $ZIPFILE,uuencode $ZIPFILE $ZIPFILE and uuencode $ZIPFILE $ZIPFILENAME all of them. – Manu Feb 27 '12 at 11:30