Sending A Text (SMS) from PHP

Awesome find today! Ever have a need to send a text (SMS) message to a phone from a PHP application? Well, here is a way you can now do exactly that. I won’t try to make this a long post because there is nothing else I can say other than, here is the code.


//Recipient’s SMS Network Choice
$Number=ereg_replace(“[^A-Za-z0-9]”, “”, $_POST[‘phone_number’]);

//Set up the message
$Message=”Here is a new message sent from PHP right to your phone!!”;
$headers = ‘From: This PHP App’ . “rn”;

//Now ready and send! (Use only the network that is applicable);
mail($Metro1, ‘Alert’, $Message,$headers);
mail($Metro2, ‘Alert’, $Message,$headers);
mail($Verizon, ‘Alert’, $Message,$headers);
mail($Sprint, ‘Alert’, $Message,$headers);
mail($ATT, ‘Alert’, $Message,$headers);
mail($Congular, ‘Alert’, $Message,$headers);
mail($Tmoble, ‘Alert’, $Message,$headers);
mail($Vergin, ‘Alert’, $Message,$headers);


Wasn’t that awesome… and super easy? I’ll be thinking of a way to use that in my next app.

I also just tried this, you should to. Send an email to one of the email addresses from above that applies to your mobile carrier. I did and it worked. Awesome way to send texts from email, if you know who their carrier is.

Share this with your friends!
Share on Facebook
Tweet about this on Twitter
Pin on Pinterest
Share on LinkedIn

1 Comment »

  1. This is what I wanted!

    Comment by Chelsey — September 25, 2013 @ 9:14 pm

Leave a comment