Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ksh
- export MAILFROM="ashish.talreja@yahoo.com"
- export MAILTO="sunil.rao@gmail.com"
- export SUBJECT="New Report"
- export BODY="/app/bo_report_schedule.html"
- export ATTACH="/app/report.pdf"
- export MAILPART="$RANDOM" ## Generates Unique ID
- export MAILPART_BODY="$RANDOM" ## 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 -m $ATTACH $(basename $ATTACH)
- uuencode $ATTACH $(basename $ATTACH)
- echo "--$MAILPART--"
- ) | /usr/sbin/sendmail $MAILTO
- (echo "hi" , uuencode report.pdf report.pdf) | mailx -s "Attached is the report" "ashish.talreja@yahoo.com"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement