Recently I’ve had to implement an alert system in PHP were the alerts are sent via a text message. The concept is very simple – use an email to SMS gateway. Essentially, you send an email to a phone companies gateway server, that server then relays the email to the phone number specified via a SMS. Since PHP has the ability to send emails, the whole process is quite easy.
1. First you need to acquire a list of SMS gateways you are going to support. For an extensive list, check out Wikipedias List of SMS Gateways. For this tutorial, I will only be using AT&T Wireless (number@txt.att.net) and Verison (number@vtext.com).
2. Create a simple HTML form.
[code lang="html"]
[/code]
3. Add the necessary PHP code to send the email
[code lang="PHP"]
if(!empty($_POST['number'])) {
mail($_POST['number'] . $_POST['provider'], $_POST['subject'], $_POST['message']);
}
?>
[/code]
You will want to do some better error checking and validation, but thats it!
please take a look at your email and leave a message
|
What email address should I be checking?
|
Thank you so much for submitting your tutorial to Pixel2life, your submission has been accepted
I look forward to more tutorials from your site in the future!
|