Mail To Phone...


I was wondering if anyone has ever seen, heard, or knows about any scripts, tutorials or information on sending a Text Message to a phone via an HTML Form/PHP. I have a simple script already, just your basic mail script that sends a text message to a user specified phone number. As of now you have to manually change which carrier. The message goes through except the FROM always says the default email address of the server and not the one I want to use. Like the one I am hard coding isn’t passing through.

Any help or direction on understanding this better would be of great help.

Thank you…

Code I have as of now below:


<? $phone = $_POST['phone']; $msg = stripslashes($_POST['msg']); //$to = $phone . ""; //$to = $phone . ""; $headers = "Reply-To:"; $to = $phone . ""; $subject = "Online Request"; mail($to, $subject, $msg, $headers); echo "You text message has been sent successfully!" ?>


Tried -
Serveral Header Stuff. The from always comes up from the defualt address of the server and not who I put in.

Note - I stripped out all the extra stuff. This is just where the problem occurs.

Thanks -


Be aware of the difference between sending a mail and a text message (Short Message Service or SMS, as we call it). Most cell phones nowadays support SMS, but there are still many out there that don’t support receiving mail (or even connecting to the internet).

I’m not sure if it’s possible to send a mail message directly to a phone number, but I assume you’re trying to send a mail to a mail address which can be accessed by a cell phone? So basically mail -> mailbox, cellphone -> mailbox. As far as I know, mail -> cellphone directly is not possible (but I could be wrong here). In case you’re sending a mail to another person’s mailbox (which they will then access through their cellphone), it should work just like sending a mail message to any other online mailbox.

Also, make sure you use the "From: " header. Furthermore, I think this is quite dependent on which mail server/application you’re using.

Not sure if that was helpful …


You are wrong. ;) You can and I have done it, the only thing that isn’t working is when the message comes through to my phone is the From:… It comes through as nobody@myhostingservice.ems. So yes it is possible. Just go to most cell service providers and they the same kind of service. Type in anyone’s number using their service and the message and any other information they require hit send and it sends a message to thier cell phone as a text message.

I have the list of addresses. Just having trouble getting the From header to come through as the correct number or email address.

I have several different header information and nothing seems to work.

I am just trying to find more information on this more than a solution. If someone has a solution that would be great. I have been searching and scouring the internet for a day or more trying to find everything I can and seems info is a little scarce.

Thanks for any and all help.


Wait, you’re using an app from your provider? Wouldn’t that mean they could easily overwrite the From header with their own version of it? I thought you were actually sending a mail from your own machine.


No… I am not using a service provider. I was simply providing proof that it can and is being done by many.

I am using my own script which I have created which is working except for when the message comes through it comes through saying From: nobody@myserviceprovider.ems

So I am wondering if anyone has any information on how to fix this or where I can read on how to get this working or why I wouldn’t be able to get it working.

Also, I have search for several hours and saying - “Search Google” will not help.


Not sure, but maybe it is that your header has Reply-To instead of From

vs mine only has it as from

$from = ‘’;

mail($to, $subject, $body, “From: $from”)

I ran into this same problem for a while, all mail would come from