Featured Post

The white-Left Part 1: The two meanings of white

Friday, November 2, 2018

Sending texts to get out the vote - A Linux hack

Since I consider this to be a political blog, I almost never post anything from the technical side of Linux here at Linux Beach. Tonight I am making an exception because this crosses the nexus of politics and technology.

If you've followed Linux Beach for a few years, you know that I focused my attention on defeating Donald Trump in 2016...............................................and lost.

I now think we are facing the most crucial election of our lifetime.

If we lose this election, we could well lose our country to fascism.

Therefore, I think that all of us should be pulling out all the stops, to vote, and to get other progressives to the polls. This is not an election you are going to want to say you sat out.

So in that spirit, earlier today, I decided that I would send texts to the mobile phones of all my friends and associates, not only to ask them to vote, but also to text their friends and associates, asking them to do the same.

While looking into the easiest way to do this, I discovered that you can send a text message via email. The way you do that is by sending an email with the text to 10digit-ph-number@vtext.com with the text in the body. so if you send:

Email : 3105551212@vtext.com
Subject Line: PLEASE VOTE
Body : Please text all your friends, asking them to vote on Tuesday & text their friends. Vote like your life depended on it!


The mobile phone @ 3105551212 will receive this text:
(PLEASE VOTE) Please text all your friends, asking them to vote on Tuesday & text their friends. Vote like your life depended on it!
This may only send from @vtext.com if you are Verizon customer, which I am, but I since I sent from two email addresses not linked {AFAIK 😉} to my Verizon account, I think it should work for anybody. If not, your mobile provider may have something similar. {Google is your friend. 😌}

In an effort to make this even easier, I turned to automation via a little bash scripting on Linux.
bash shell
Note on Linux history: bash stands for "born again shell." You see, an earlier version was written by a guy named Bourne, and became known as the Bourne shell. So, when eventually it was substantially rewritten and upgraded, it got a funny new name, just because that's the way we like to do things in Linux world.
First, I created a list of phone numbers, one 10 digit number per line with anything that wasn't a number removed, so that the list looked like this:

3123456789
2123456789
4123456789
3123456789
...

Except with real numbers.

I got the numbers from my Google Contacts. First I followed this guide to export the contacts I wanted to text to a spreadsheet: How to Export Your Gmail Contacts Then in the spreadsheet, in my case Libre Calc, I deleted all the columns except the phone number column. Then I exported that 1 column spreadsheet back to a CVS file that I could then load into a text editor, in my case, gedit. In the editor, I cleaned up the phone numbers by deleting all (,)-, spaces, and starting 1 or +1, so that they all conformed to the example above. Then I saved it to a file named numbers.txt

Also with the text editor I created the body of the email in a file named vote.txt with this content:
Please text all your friends, asking them to vote on Tuesday & text their friends. Vote like your life depended on it!
Did I mention that I did all of this in a ssh shell on a Linux server that already has a functioning mail server such as postfix? This is key, because if you can't already use the mail command to send email, this won't work.

With those two files, vote.txt with the message, and numbers.txt in the same directory on a Linux mail server, I ran the following simple bash script:
for n in $(cat numbers.txt)
do
mail -s "PLEASE VOTE" -r cjc@Linuxbeach.net $n@vtext.com < vote.txt
sleep 120
done
What this script is doing, even as I write this, is taking a number from that list, sending a text message-email to it, it waiting 120 seconds, and sending to the next one on the list. The 120 second delay is so that, hopefully, this won't be flagged as automation or spam. So far, so good.

If you received a PLEASE VOTE text from me today, this is how it was done. I have taken the further step of telling you how I did it in the hope that it will give others an idea of how they might get the message out.

BTW, all the software I mentioned in this post is FREE SOFTWARE. Meaning free as in beer and free as in speech. Your freedom to use this labor-donated software is protected by the GNU "Copy-Left" License.

Go Vote!


Syria is the Paris Commune of the 21st Century!

Click here for our posts on the 2016 US Election
Click here for a list of our other blogs on Syria
Click here for a list of our other blogs on Libya

No comments:

Post a Comment