Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/bash
- # send-email.sh
- ################################################################################################
- ##;//-------------------------------------------------------------------------------------------
- ##;// ||
- ##;// //|\,
- ##;// // | \+
- ##;// // | \&
- ##;// // | \*
- ##;// // | \[
- ##;// // | \]
- ##;// // | \.
- ##;// // | \\
- #;// Written By: Joey Brock (C) 2012-2016
- #;// Copyright (c) 2016 Greenskyware.com
- #;// Author: Joey Brock - Plant City, FL 33563
- #;// [E] jybrock{at}dpro{dot}com
- #;// [D] 10-07-2013
- #;// [U] 08-08-2016
- #;// [P] 727.755.1522
- ## Licensed:-------MIT/Expat License
- ## Product: -------${Send Email from File using sendemail [GSW]}
- ## Version:--------v1.0.0.0
- ## Developer:------Greenskyware, Inc.--(All Rights Reserved)
- ##;//-------------------------------------------------------------------------------------------
- ################################################################################################
- # Permission is hereby granted, free of charge, to any person obtaining a copy of this software
- # and associated documentation files (the "Software"), to deal in the Software without
- # restriction, including without limitation the rights to use, copy, modify, merge, publish,
- # distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
- # Software is furnished to do so, subject to the following conditions:
- ################################################################################################
- # The above copyright notice and this permission notice shall be included in all copies or
- # substantial portions of the Software.
- ################################################################################################
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
- # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
- # DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- ################################################################################################
- ##;// Global Variables
- str_Filename=$(echo -n "/tmp/foo.bar.info")
- ##;// Display Usage
- # Comment this out if you do not want to have usage displayed.
- # Or change it around to fit your needs.
- Function display_usage() {
- echo "This script must be run with super-user privileges."
- echo -e "\nUsage:\n$0 [file to email] \n"
- }
- # If less than two arguments supplied, display usage
- if [ $# -e 1 ]; then
- str_Filename=$1
- fi
- # Check whether user had supplied -h or --help. If yes display usage
- if [[ ( $# == "--help") || $# == "-h" ]]; then
- display_usage
- exit 0
- fi
- # Display usage if the script is not run as root user
- if [[ $USER != "root" ]]; then
- echo "This script must be run as root!"
- exit 1
- fi
- ##;// Main
- #NOTE: If you receive an SSL Certificate error,
- # this is a known issue with Perl5
- #
- # To Fix:
- # Open /usr/share/perl5/IO/Socket/SSL.pm
- #
- # Replace:
- # m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))$}i
- #
- # With:
- # m{^(!?)(?:(SSL(?:v2|v3|v23|v2/3))|(TLSv1[12]?))}i
- # Add your own SMTP Credentials and email configuration here
- while read p; do
- sendemail -s '":" ' \
- -o username='' \
- -o password='' \
- -f '' \
- -u '' \
- -t "echo $p" \
- -m ''
- done < "${str_Filename}"
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement