Ma réponse besoins en base64 en plus de mail, mais certains uuencode versions pouvez aussi le faire en base64 avec-m, ou vous pouvez oublier le mime et l'utilisation de la plaine uuencode de sortie...
FROM=me@mydomain.com
TO=someone@mydomain.com
SUBJECT="Auto emailed"
MIME="application/x-gzip" # Adjust this to the proper mime-type of file
FILE=somefile.tar.gz
ENCODING=base64
boundary="---my-unlikely-text-for-mime-boundary---$$--"
(cat <<EOF
From: $FROM
To: $REPORT_DEST
Subject: $SUBJECT
Date: $(date +"%a, %b %e %Y %T %z")
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary="$boundary"
Content-Disposition: inline
--$boundary
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
This email has attached the file
--$boundary
Content-Type: $MIME;name="$FILE"
Content-Disposition: attachment;filename="$FILE"
Content-Transfer-Encoding: $ENCODING
EOF
base64 $FILE
echo ""
echo "--$boundary" ) | mail