Created
December 12, 2022 16:21
-
-
Save Vortexdude/3392e482b25a8d7d3df6b07ebcf754ad 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 | |
export MAILFROM="[email protected]" | |
export MAILTO="[email protected]" | |
export SUBJECT="Test PDF for Email" | |
export ATTACH="You_file_with_no_spaces.pdf" | |
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 "This file is send from $(hostname -i) server" | |
echo "--$MAILPART_BODY" | |
echo "Content-Type: text/html; charset=ISO-8859-1" | |
echo "Content-Disposition: inline" | |
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 -m $ATTACH $(basename $ATTACH) | |
uuencode $ATTACH $(basename $ATTACH) | |
echo "--$MAILPART--" | |
) | /usr/sbin/sendmail $MAILTO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment