Skip to content

Instantly share code, notes, and snippets.

@MotionDesignStudio
Created February 17, 2015 00:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MotionDesignStudio/2927b8f2b6d117447e8f to your computer and use it in GitHub Desktop.
Save MotionDesignStudio/2927b8f2b6d117447e8f to your computer and use it in GitHub Desktop.
Mass Send (Text Messages) SMS Via Email Address
Modify this line of sendtxtmsg0.sh to ensure it finds the perl script properly.
printf "%s\n" "`./sendEmail-v1.55/sendEmail -f ${2} -t ${line}${providers} -m ${6} -o tls=auto -s ${5} -xu ${3} -xp ${4}`"
Download sendEmail from here
http://caspian.dotconf.net/menu/Software/SendEmail/sendEmail-v1.55.tar.gz
You can also manually retrieve it from here.
http://caspian.dotconf.net/menu/Software/SendEmail/
Example:
To use this script call it with the following parameters.
./sendtxtmsg0.sh phonenumbers.txt myemailaddress@provider.com username password smtp.emailprovider.com "My message in quotes."
2125555555
2125556666
@txt.att.net
@cingularme.com
@page.metrocall.com
@messaging.nextel.com
@messaging.sprintpcs.com
@tmomail.net
@vtext.com
@message.alltel.com
#!/bin/bash
##############################################################################
## Lex's mass send SMS script
## Written by: Lex Peters <mo-de.net>
##
## License:
## Lex's mass send SMS script (hereafter referred to as "program") is free software;
## you can redistribute it and/or modify it under the terms of the GNU General
## Public License as published by the Free Software Foundation; either version
## 2 of the License, or (at your option) any later version.
## When redistributing modified versions of this source code it is recommended
## that that this disclaimer and the above coder's names are included in the
## modified code.
##
## Disclaimer:
## This program is provided with no warranty of any kind, either expressed or
## implied. It is the responsibility of the user (you) to fully research and
## comprehend the usage of this program. As with any tool, it can be misused,
## either intentionally (you're a vandal) or unintentionally (you're a moron).
## THE AUTHOR(S) IS(ARE) NOT RESPONSIBLE FOR ANYTHING YOU DO WITH THIS PROGRAM
## or anything that happens because of your use (or misuse) of this program,
## including but not limited to anything you, your lawyers, or anyone else
## can dream up. And now, a relevant quote directly from the GPL:
##
## NO WARRANTY
##
## 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
## FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
## OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
## PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
## OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
## TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
## PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
## REPAIR OR CORRECTION.
##
##############################################################################
# To use this script call it with the following parameters.
#./sendtxtmsg0.sh phonenumbers.txt myemailaddress@provider.com username password smtp.emailprovider.com "My message in quotes."
#Always end the file containing the telephone number(s) with a new line. If it contains one telephone number with no newline at the end then it will not loop threw at all unless you add a newline.
#use the following to cleanup and create text files list for mass send SMS.
#cat gymnasts_contact.txt | sed -e '/[a-z]$/Id' -e '/\s$/d' -e 's/^1.//g' -e '/^$/d' -e 's/[[\.-]//g' >cleanedupcontactfile.txt
#contacts.txt
#Should start off looking similar to this.
#Lex Peters
#myemail@fakemail.com
#1-444-444-4444
#1.555.555.5555
#Gorde Peters
#My fat
#myemail@fakemail.com
#1.666.666.6666
#Once you have ran the SED command it will leave you with this.
#cleanedupcontactfile.txt
#4444444444
#5555555555
#6666666666
clear #clear the screen
# Set loop separator to end of line
BAKIFS=$IFS
IFS=$(echo -en "\n\b")
printf "%s\n" "Phone Book: ${1}"
printf "%s\n" "Full Return Email Address: ${2}"
printf "%s\n" "User Name: ${3}"
printf "%s\n" "Password: ${4}"
printf "%s\n" "SMTP Mail Provider: ${5}"
printf "%s\n" "Message: ${6}"
FILE=""
printf "%s\n" #add a line break
#SANITY CHECK
#Make sure we get the file from command line, check if it exists and is readable.
declare -i PASSSANITYCHECK=0
if [ -s $1 -a -r $1 ]; then
if [ ! -z $6 ]; then #Checking if the message string exists and has copy in it.
PASSSANITYCHECK=1
FILE=${1}
printf "%s\n\n" "Proceesing the following numbers from ${FILE}."
while read thephonenumber
do
printf "%s " "${thephonenumber}"
done <"${FILE}"
else
echo -e "The text messages have not been sent because you need to fix one of the following. \n 1. Ensure you have copy to be sent to your recipients. \n 2. The script can read the file containing the phone numbers and providers.txt."
fi
fi
printf "%s\n\n" #add a line break
if [ $PASSSANITYCHECK -eq 1 ]; then
while read line
do
printf "%s\n" "Sending a message to ${line} using all the providers in \"${FILE}\"."
#sleep 1 #This adds a delay in seconds.
while read providers
do
printf "%s\n" " Sending MESSAGE: ${6} TO: ${line}${providers}"
printf "%s\n" "`./sendEmail-v1.55/sendEmail -f ${2} -t ${line}${providers} -m ${6} -o tls=auto -s ${5} -xu ${3} -xp ${4}`"
sleep 2 #This adds a delay in seconds.
done <"providers.txt"
done <"${FILE}"
fi
# restore $IFS which was used to determine what the field separators are
IFS=$BAKIFS
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment