Posted on 2018/04/18 at 5:52 pm
For personnel projects, one might need to send a message to a phone to give updates or alerts. This can be done relatively easily by using PHP and its "mail()" command. But, we need to know what gateway to send it to and what the number is. The number part is easy but gateways vary. So, here is a reference list of Email-to-SMS Gateways. In addition, there is a quick code reference part to help get the ball rolling. As a final point before starting, you will need a proper mailing system and FQDN to make sure messages get through. Some gateways are highly fickle and you might not always get the SMS sent through using this setup. So, don't use this in a commercial context unless you do the aforementioned.
First, you'll need the program "mail()" uses to send messages. In a terminal do:
sudo apt-get install sendmail
Then, edit the host file found at /etc/hosts. You'll have something like this at the top: 127.0.0.1 localhost. You need it to be setup the proper FQDN syntax; so, something like this: 127.0.0.1 localhost.example.com is needed. After all that is setup (You might need to reboot.) you simply need to insert into a PHP script the following:
$number = "[email protected]";
$subject = "Your sybject message here."; // Not used in text messages per say
$tmessage = wordwrap("Your message here.", 70 );
mail($number, $subject, $tmessage);
Cell Carrier | Email Domain |
AT&T Enterprise Paging | page.att.net |
AT&T Wireless | txt.att.net |
Alaska Communication Systems | msg.acsalaska.com |
Alltel | text.wireless.alltel.com Now part of AT&T |
Australia T-Mobile/Optus Zoo (Optus) | optusmobile.com.au Appears they charge for the service |
Bell Mobility & Solo Mobile | txt.bell.ca |
Bluegrass Cellular | sms.bluecell.com |
Boost Mobile | myboostmobile.com |
Cellcom | cellcom.quiktxt.com |
Cellular South (C Spire) | cellularsouth1.com (now cspire1.com) |
Centennial Wireless | cwemail.com |
Cincinnati Bell | gocbw.com |
Cingular | cingular.com Merged with AT&T Mobility 2007 |
Cingular Prepaid | cingulartext.com |
Cox Wireless | Discontinued 2012 |
Cricket Wireless | mms.cricketwireless.net |
Digicel St. Lucia | digitextlc.com |
Fido | fido.ca |
Google Voice | Not an actual carrier |
GCI Alask Digitel (GCI) | mobile.gci.net |
IV Cellular (Illinois Valley Cellular) | ivctext.com |
i wireless (iWireless) | iwspcs.net (T-Mobile) iwirelesshometext.com (Sprint PCS) |
Koodo Mobile | msg.telus.com |
Lime | txt2lime.com |
Metro PCS | mymetropcs.com |
Mobilicity | No email-to-SMS service |
MTS Mobility | text.mtsmobility.com |
NET10 | Determine NET10's carrier |
Nex-Tech | sms.nextechwireless.com |
nTelos | pcs.ntelos.com Will change to Sprint early 2016 |
O2 (M-mail) | mmail.co.uk |
O2 Powered Networks | |
O2 UK | o2imail.co.uk |
Optus | optusmobile.com.au Appears they charge for the service |
Orange | orange.net |
PC Telecom | mobiletxt.ca |
PTel Mobile | tmomail.net |
Pioneer Cellular | zsend.com |
Pocket Wireless | sms.pocket.com |
Republic Wireless | text.republicwireless.com |
Rogers Wireless | pcs.rogers.com |
SaskTel | sms.sasktel.com |
Sprint | messaging.sprintpcs.com |
Straight Talk | Determine Straight Talk's carrier |
Syringa Wireless | rinasms.com |
T-Mobile | tmomail.net |
T-Mobile UK | t-mobile.uk.net |
Telstra | onlinesms.telstra.com |
Telus Mobility | msg.telus.com |
Three | three.co.uk |
Tracfone | Determine Tracfone's carrier |
US Cellular | email.uscc.net |
Unicel | utext.com |
Verizon | vtext.com |
Viaero | viaerosms.com |
Virgin Mobile | vmobl.com |
Virgin Mobile Canada | vmobile.ca |
Virgin Mobile UK | vxtras.com |
Vodafone | No email-to-SMS service |
Wind Mobile | txt.windmobile.ca |
Check out my article regarding Quick Test Servers so you can test this out properly!