Message for You, Sir!
In my Open-Source Classroom column in the May 2016 issue, I discussed how to set up Gmail as your SMTP provider for outgoing email. The problem with email is that sometimes the sheer quantity of it makes important messages slip past my radar. So for really important error messages, I like to get SMS messages. Thankfully, I get several orders of magnitude fewer text messages than I do email messages. That means if a text comes, I almost always notice, and I always check it. ("Inbox Zero" is far more attainable with my SMS inbox!)
Most providers have an email gateway for sending text messages, but
figuring out what format to use for what number is frustrating. I prefer
a simple way to add a one-liner into a script that will send a text
message. Thankfully, Ian Webster provides TextBelt free of charge! You
can download the source code and host it yourself if you prefer, but Ian
graciously offers a running instance of TextBelt that is free as in beer
and free as in speech to use. To send a text, simply use
curl -X POST http://textbelt.com/text -d number=5551234567 -d ↪'message=Warning! Your server is on fire! Also, ↪you are out of milk.'
The code above will send a text message to any of the major carriers in the US. You'll get a response on the command line showing either success or failure. There's also an international gateway that is available; go here for more information.
Note: there are a still a few goofy carriers. My Android phone is on Cricket Wireless, and although I do get a success message, the text never arrives. I suspect this is because Cricket recently changed its email gateway; hopefully the TextBelt code will be updated shortly. The moral of the story is, test first before relying on the service to work!
Limited Time Offer
Take Linux Journal for a test drive. Download our September issue for FREE.
Topic of the Week
The cloud has become synonymous with all things data storage. It additionally equates to the many web-centric services accessing that same back-end data storage, but the term also has evolved to mean so much more.