cancel
Showing results for 
Search instead for 
Did you mean: 

SMS to your phone from your website

SoulBriski
Grafter
Posts: 179
Registered: ‎15-06-2007

SMS to your phone from your website

After a litle bit of digging i have partially solved my own problem but i suspect others may appreciate this.
My website http://www.jnmbc.co.uk allows users to upload images. When they submit an image, I recieve an email notification so that i can examine the image and caption before posting it to the gallery.
The problem is that if I am away from my email it could be a couple of days before i realise an image upload request has been made so my solution is to send an SMS text alert to my mobile.
I spoke to my mobile network provider (t-mobile) and they implimented the Free of Charge service for me.
Phone your network supplier and ask them to set up the service for you. It may take an hour or two to become active, mine took ten minutes.
You can test this easily by sending an email to your own phone as an SMS
If you are on t-mobile then send an email to yourmobilenumber@t-mobile.uk.net
Although this method works directly from any email client, i am still testing it from within my website but a little bit unsure about headers etc.
this is the sendsms.php that processes it
<?php
//If we are here then the image was uploaded to the holding area so send the SMS alert
$to = "0123456789@t-mobile.uk.net";
$subject = "Request to add image to gallery";
$message = "Login to admin area and check the picture";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'Reply-To: '.$eMail . "\r\n";
$headers .= 'From: '.$eMail;

if(mail($to,$subject,$message,$headers))
{
echo "<p><strong>Thankyou! SMS sent</strong></p>";
} else {
echo "<p><strong>SMS failed! Sorry, your sms could not be sent</strong></p>";
}
?>


Hope this helps the community.
5 REPLIES
SoulBriski
Grafter
Posts: 179
Registered: ‎15-06-2007

Re: SMS to your phone from your website

My testing is now complete and i am happy to confirm that the above php script works perfectly well.
I went to my website, clicked on my test link that runs the sendsms.php and 15 minutes later i recieved a text alert on my mobile phone.
I hope this post is helpful to someone
SoulBriski
Grafter
Posts: 179
Registered: ‎15-06-2007

Re: SMS to your phone from your website

Yes indeed!
I'm sure there are many instances when this could be used.
I've changed my script now to be a simple function in my functions.php instead of a separate page so i just call it from anywhere in my site where i need to be notified of anything.
I keep the sms mesages simple, just something like "A user has uploaded an image" or "Someone has requested membership info" or "someone wants to add a link to their website"
I'm going to continue to develop this idea and see where i can take it.
SoulBriski
Grafter
Posts: 179
Registered: ‎15-06-2007

Re: SMS to your phone from your website

I hope it proves to be as easy for you as it was for me.
It was only made difficult because all my searches on the subject pointed to someone trying to sell me an sms service when all that was needed was one free phone call to t-mobile.
i cant guaruntee that other networks will do it FOC but they should do Grin
decomplexity
Rising Star
Posts: 493
Thanks: 26
Registered: ‎30-07-2007

Re: SMS to your phone from your website

If anyone knows whether Orange UK provides such a service, I would love to use it. I have looked but drawn a blank on their consumer and business  websites.
Zen from May 17. PN Business account from 2004 - 2017
SoulBriski
Grafter
Posts: 179
Registered: ‎15-06-2007

Re: SMS to your phone from your website

I didn't have any joy browsing the website of t-mobile when i was looking for my solution so thats why i phoned them.
I would add though that when i requested info on the subject, the guy i spoke to said it couldn't be done but i bluffed my way through by saying that other network providers did it so I'm sure that t-mobile would. At that he went away to ask his supervisor and returned to give me the 't-mobile.uk.net' bit that i needed.
The moral of this story? Dont be fobbed off