Advertisement
Guest User

Untitled

a guest
Aug 8th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.53 KB | None | 0 0
  1. #! /bin/bash
  2. # send-email.sh
  3.  
  4. ################################################################################################
  5. ##;//-------------------------------------------------------------------------------------------
  6. ##;// ||
  7. ##;// //|\,
  8. ##;// // | \+
  9. ##;// // | \&
  10. ##;// // | \*
  11. ##;// // | \[
  12. ##;// // | \]
  13. ##;// // | \.
  14. ##;// // | \\
  15. #;// Written By: Joey Brock (C) 2012-2016
  16. #;// Copyright (c) 2016 Greenskyware.com
  17. #;// Author: Joey Brock - Plant City, FL 33563
  18. #;// [E] jybrock{at}dpro{dot}com
  19. #;// [D] 10-07-2013
  20. #;// [U] 08-08-2016
  21. #;// [P] 727.755.1522
  22. ## Licensed:-------MIT/Expat License
  23. ## Product: -------${Send Email from File using sendemail [GSW]}
  24. ## Version:--------v1.0.0.0
  25. ## Developer:------Greenskyware, Inc.--(All Rights Reserved)
  26. ##;//-------------------------------------------------------------------------------------------
  27. ################################################################################################
  28. # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
  29. # and associated documentation files (the "Software"), to deal in the Software without
  30. # restriction, including without limitation the rights to use, copy, modify, merge, publish,
  31. # distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
  32. # Software is furnished to do so, subject to the following conditions:
  33. ################################################################################################
  34. # The above copyright notice and this permission notice shall be included in all copies or
  35. # substantial portions of the Software.
  36. ################################################################################################
  37. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
  38. # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  39. # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
  40. # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  42. ################################################################################################
  43. ##;// Global Variables
  44. str_Filename=$(echo -n "/tmp/foo.bar.info")
  45.  
  46. ##;// Display Usage
  47. # Comment this out if you do not want to have usage displayed.
  48. # Or change it around to fit your needs.
  49.  
  50. Function display_usage() {
  51. echo "This script must be run with super-user privileges."
  52. echo -e "\nUsage:\n$0 [file to email] \n"
  53. }
  54.  
  55. # If less than two arguments supplied, display usage
  56. if [ $# -e 1 ]; then
  57. str_Filename=$1
  58. fi
  59.  
  60. # Check whether user had supplied -h or --help. If yes display usage
  61. if [[ ( $# == "--help") || $# == "-h" ]]; then
  62. display_usage
  63. exit 0
  64. fi
  65.  
  66. # Display usage if the script is not run as root user
  67. if [[ $USER != "root" ]]; then
  68. echo "This script must be run as root!"
  69. exit 1
  70. fi
  71.  
  72.  
  73. ##;// Main
  74. #NOTE: If you receive an SSL Certificate error,
  75. # this is a known issue with Perl5
  76. #
  77. # To Fix:
  78. # Open /usr/share/perl5/IO/Socket/SSL.pm
  79. #
  80. # Replace:
  81. # m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i
  82. #
  83. # With:
  84. # m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))}i
  85.  
  86. # Add your own SMTP Credentials and email configuration here
  87. while read p; do
  88. sendemail -s '":" ' \
  89. -o username='' \
  90. -o password='' \
  91. -f '' \
  92. -u '' \
  93. -t "echo $p" \
  94. -m ''
  95. done < "${str_Filename}"
  96.  
  97. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement