Development
Stupid cell phone tricks
Freshness Warning
This blog post is over 19 years old. It's possible that the information you read below isn't current and the links no longer work.
6 Jan 2005
For a project I’m working on we need to send text messages to mobile phones. We could buy or rent an SMS gateway, but most carriers in the US allow you to email a message to yourphonenumber@yourcarrier and it will appear as a text message on the phone. For example, my phone is currently with AT&T so you can send a short email to 9166002497 AT mobile.att.net and it will show up on my phone.
The problem is figuring out what carrier the phone number is at so you can append the correct hostname to the email address. John Wehr pointed out Teleflip, a service that lets you send email to yourphonenumber@teleflip.com and have it delivered to the phone, regardless of carrier. That’s dandy, but I don’t want to rely on some free, third party service that might change or go away later.
After spending some time looking for a way to determine the phone’s carrier, it hit me: I don’t really care what carrier they’re using. If I send the message to the incorrect carrier, it won’t get delivered to the wrong person because phone numbers are unique. It will just bounce. So if I wanted to send a message to 212-555-1212, I could just send a text message to 2125551212@mobile.att.net, 2125551212@messaging.sprintpcs.com, 2125551212@messaging.nextel.com and so on. Send to them all and ignore the bounces. Based on the bounces, you could even learn which carrier someone’s using and just send to that one in the future.
It’s not terribly polite to send email that you know is going to bounce, but it’s not a huge load on the servers and you’d only do it once for each new number.