Advertisement
Guest User

Untitled

a guest
Mar 6th, 2019
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. #!/usr/bin/ksh
  2. export MAILFROM="ashish.talreja@yahoo.com"
  3. export MAILTO="sunil.rao@gmail.com"
  4. export SUBJECT="New Report"
  5. export BODY="/app/bo_report_schedule.html"
  6. export ATTACH="/app/report.pdf"
  7. export MAILPART="$RANDOM" ## Generates Unique ID
  8. export MAILPART_BODY="$RANDOM" ## Generates Unique ID
  9.  
  10. (
  11. echo "From: $MAILFROM"
  12. echo "To: $MAILTO"
  13. echo "Subject: $SUBJECT"
  14. echo "MIME-Version: 1.0"
  15. echo "Content-Type: multipart/mixed; boundary="$MAILPART""
  16. echo ""
  17. echo "--$MAILPART"
  18. echo "Content-Type: multipart/alternative; boundary="$MAILPART_BODY""
  19. echo ""
  20. echo "--$MAILPART_BODY"
  21. echo "Content-Type: text/plain; charset=ISO-8859-1"
  22. echo "You need to enable HTML option for email"
  23. echo "--$MAILPART_BODY"
  24. echo "Content-Type: text/html; charset=ISO-8859-1"
  25. echo "Content-Disposition: inline"
  26. cat $BODY
  27. echo "--$MAILPART_BODY--"
  28. echo "--$MAILPART"
  29. echo 'Content-Type: application/pdf; name="'$(basename $ATTACH)'"'
  30. echo "Content-Transfer-Encoding: uuencode"
  31. echo 'Content-Disposition: attachment; filename="'$(basename $ATTACH)'"'
  32. echo ""
  33. #uuencode -m $ATTACH $(basename $ATTACH)
  34. uuencode $ATTACH $(basename $ATTACH)
  35. echo "--$MAILPART--"
  36. ) | /usr/sbin/sendmail $MAILTO
  37.  
  38. (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