sendmailを使用して、テキストファイルで構成されるzipファイルをIDに添付ファイルとしてメールで送信しています。このzipファイルをメールから解凍しようとすると、無効なアーカイブディレクトリが表示されます。手伝ってください。
#!/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