7.9. Send Visitor Messages to Your Mobile Phone

Problem

You need to receive urgent messages from your web site on your mobile phone.

Solution

Create a simple email form that, combined with a JavaScript character counter, sends SMS messages from your web site to your mobile phone.

Discussion

Short Message Service (SMS) allows mobile phone users on nearly all major carriers to send and receive short alphanumeric messages. Also called texting, the practice is wildly popular in Europe and Asia and with younger cell phone users in the United States. Originally created for the GSM cell networks of Europe in the early 1990s, SMS traffic has grown from 250 billion messages sent in 2000 to more than 500 billion sent in 2004.

The SMS protocol can communicate with external systems, including email, which means that you can set up an emergency contact form on your web site that your customers, patients, or even boss can use to quickly send you important messages. Figure 7-10 shows a form I created to send SMS messages to my cell phone. Like other cell phone accounts, mine has an email address associated with it, which is my ten-digit mobile number @mobile.mycingular.com. My account also has a 160-character limit on SMS messages, so I've added some JavaScript to count characters as the visitor types his message, as well as a warning message that appears when the message is over the limit.

The JavaScript function smsLimiter takes three parameters: the name of the textarea field where the SMS message ...

Get Web Site Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.