Skip to content

Sending Text Messages From Xojo Apps

I recently wrote a big data processing app that was going to run for a while dealing with data that was occasionally inconsistent in ways I couldn’t anticipate. I knew that it was going to encounter trouble at some point and when it did, I would see what the problem was, fix it and start it running again. It was running on a server and after I started running it I found myself frequently checking on its progress.

Rather than continue to check on it constantly, I decided it would save me so much time and trouble if the app could text me when it runs into a problem it can’t manage. Fortunately, this is relatively easy to do. Most carriers allow you to send text messages in the form of an email message. In short, you form an email address from your cell phone number and a special domain your carrier provides. With this email address you then use Xojo’s SMTPSecureSocket class, designed specifically for sending email, and provide the socket information on how to login to your email server (the same info you provide when adding your email account to an email app) and then send a message to the appropriate email address for your carrier so that it will be sent to your phone in the form of a text message. If you’ve never used the SMTPSecureSocket before, check out the example code in the Xojo Documentation.

This isn’t a general purpose solution for sending text messages because the carrier will only allow you to send messages to numbers it manages. But this example is a good and simple solution for monitoring you own apps via text messages. There are paid-services that provide REST APIs for a more general purpose solution. In fact, if that is what you need, here’s an earlier Xojo blog post about sending text messages using Twilio.

Geoff is the Founder and CEO of Xojo, Inc. He started what became Xojo in 1996 and he has been working to improve it ever since. When he’s not steering the ship at Xojo, he’s keeping the beat for the band he formed in high school and learning Korean.