DEV Community

Zachary Perkins
Zachary Perkins

Posted on • Edited on

How to send texts in any programming language for free

UPDATE June 16, 2025:

Wow it's been a long time since I wrote this. All the information below is still accurate, and I'll do my best to update it when it's not, but even though it's accurate, some services, such as T-Mobile, can be a bit hit or miss on whether they let the text go through. You can follow the instructions in this post if you want to receive texts specifically, but if you just want notifications on your phone, I personally recommend https://ntfy.sh/. I've been self-hosting it (though you don't have to self-host it if you don't want to) for months and have gotten every notification I sent very quickly. If you have any questions about my experience with it, feel free to leave a comment.

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). 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:

  • T-Mobile: number@tmomail.net (Note: As of April 2025, I have been having issues with them. People get the texts sometimes, but not every time)
  • Verizon: number@vtext.com
  • Metro PCS: number@mymetropcs.com
  • Cricket: number@sms.cricketwireless.net
  • Republic Wireless: number@text.republicwireless.com
  • AT&T: number@txt.att.net Update 4/4/2025: AT&T will stop supporting email-to-text messages on 6/17/2025

The number should not have any dashes or other symbols, just numbers (eg: 7185550001@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. Update: 4/4/2025: I have experience with them now. They do not let just anyone use their service. They have to approve you. They didn't approve me. If you're not a business, I doubt they'll let you in.

Top comments (0)