Last active
February 10, 2016 19:30
-
-
Save richardsonlima/43f193b61039a80afe1c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
timestamp=$(date +"%d-%m-%Y") | |
export MAILFROM="[email protected]" | |
export MAILTO="[email protected],[email protected]" | |
export SUBJECT="[ EMPRESAIt ] Linux ATI - Relatorios diarios da rede x.y.z.x" | |
export BODY="/home/EMPRESAit/Scripts/CheckDiarioTodasMaquinas/xyzx-dailycheck/body/build.html" | |
export ATTACH="/var/www/relatorio-xyzx/CheckDiario-REDExyzx-$timestamp.zip" | |
export MAILPART=`uuidgen` ## Generates Unique ID | |
export MAILPART_BODY=`uuidgen` ## Generates Unique ID | |
( | |
echo "From: $MAILFROM" | |
echo "To: $MAILTO" | |
echo "Subject: $SUBJECT" | |
echo "MIME-Version: 1.0" | |
echo "Content-Type: multipart/mixed; boundary=\"$MAILPART\"" | |
echo "" | |
echo "--$MAILPART" | |
echo "Content-Type: multipart/alternative; boundary=\"$MAILPART_BODY\"" | |
echo "" | |
echo "--$MAILPART_BODY" | |
echo "Content-Type: text/plain; charset=ISO-8859-1" | |
echo "You need to enable HTML option for email" | |
echo "--$MAILPART_BODY" | |
echo "Content-Type: text/html; charset=ISO-8859-1" | |
echo "Content-Disposition: inline" | |
cat $BODY | |
echo "--$MAILPART_BODY--" | |
echo "--$MAILPART" | |
echo 'Content-Type: application/pdf; name="'$(basename $ATTACH)'"' | |
echo "Content-Transfer-Encoding: uuencode" | |
echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"' | |
echo "" | |
uuencode $ATTACH $(basename $ATTACH) | |
echo "--$MAILPART--" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment