DEV Community

Zachary Perkins
Zachary Perkins

Posted on

How to send texts in any programming language for free

This is a short post about a not often talked about feature in mobile phone service providers.

DISCLAIMER: This will not cover receiving texts

You might've wanted to automate sending a text. Well it's actually much simpler than you might think to do that. All you need to do is send an email (this post will not cover how to do that, there are plenty of tutorials about how to do that in pretty much every language). AT&T, T-Mobile, Sprint, Metro PCS, Cricket, and Republic Wireless have an email domain that you can use to send texts via email. The email you send to is number@mobile_email_domain. Here are the domains for the listed providers:

  • AT&T: number@txt.att.net
  • T-Mobile: number@tmomail.net
  • Verizon: number@vtext.com
  • Metro PCS: number@mymetropcs.com
  • Cricket: number@sms.cricketwireless.net
  • Republic Wireless: number@text.republicwireless.com

The number should not have any dashes or other symbols, just numbers (eg: 718555001@tmomail.net)

A few final notes

  • If you know of another domain for another mobile phone service provider, feel free to leave it in the comments

  • Make sure you're properly encoding the subject and not just putting 2 newlines, like some tutorials suggest. This will work fine for some providers, and not for others. I spent way too long trying to figure out why I stopped getting texts from my program after T-Mobile changed something in their system.

  • I marked the emails with inline code blocks so they wouldn't get detected as an actual email and get highlighted

  • If you want to also receive texts, Twilio might be what you're looking for, but I have no experience with it.

Top comments (0)