Valik Rudd

Hello, I'm Valik!

Your fractional web designer, developer & web strategist.

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.

  • Chelsey
    Posted September 25, 2013 9:14 pm 0Likes

    This is what I wanted!

Leave A Comment

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

Timber Web Design
2600A E. Seltice #274
Post Falls, ID 83854


Timber Web Design © 2024. All Rights Reserved.