Unix sendmail附件变得腐败

时间:2012-02-27 10:51:20

标签: unix sendmail uuencode

我使用sendmail邮寄一个压缩文件作为附件,其中包含文本文件到我的ID。当我尝试从我的邮件中解压缩此压缩文件时,它会显示INVALID ARCHIEVE DIRECTORY.Please帮助我。

#!/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                

1 个答案:

答案 0 :(得分:0)

您可能是uuencode $ZIPFILENAME $ZIPFILE而不是uuencode $ZIPFILE $ZIPFILE