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.

Posted in Development
One comment on “Sending A Text (SMS) from PHP
  1. Chelsey says:

    This is what I wanted!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">