Usando sendmail
:
TO_ADDRESS="[email protected]"
SUBJECT="Test Mail"
cat << --OEF--
Subject: $SUBJECT
TO: $TO_ADDRESS
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="MAIL_BOUNDARY"
--MAIL_BOUNDARY
Content-Type: multipart/alternative;
boundary="MAIL_BOUNDARY2"
--MAIL_BOUNDARY2
Content-Type: text/plain; charset=utf-8
$SUBJECT
--MAIL_BOUNDARY2
Content-Type: text/html; charset=utf-8
--OEF--
cat MailBody.html
cat << --OEF--
--MAIL_BOUNDARY2--
--MAIL_BOUNDARY
Content-Type: application/zip; name=file.zip
Content-Disposition: attachment; filename=file.zip
Content-Transfer-Encoding: base64
--OEF--
base64 /opt/file.zip
cat << --OEF--
--MAIL_BOUNDARY--
--OEF--
) | /usr/sbin/sendmail $TO_ADDRESS