Call Me Back! SMS Alert Tutorial

Simple "Call Me Back!" SMS Alert
Send a Text-Message to Cell Phone or Pager from Your Website

by Megan Garrison

Introduction

Perhaps your client sells real estate or vehicles or ??? Some clients have to know right away when a potential customer is trying to contact them or maybe needs some particular information in order to make a buying decision. For whatever reason, you've been asked to provide a way to send an immediate alert from the website whenever a visitor wants the site owner to call them back. You could just create the usual email form, but what if the owner is out of the office? Plus, who has time to monitor incoming email 24/7.

The solution is actually a simple one. Create a handy "Call Me Back!" form on the website that will send a text-message to your client's cell phone or pager. Most cell phones which are capable of recieving text messages are also able to receive email. You won't need to connect to an sms gateway, just the cell phone or pager number and the carrier's designated domain (e.g. 1234567890@message.alltel.com). You can usually find the domain on the carrier's website

Other places to locate addresses:

Ok enough introduction, lets get started

Create the Basic Form

<!--- setting current page --->
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>

<p><b>Call Me Back Form</b></p>

<!--- setting form action to CurrentPage --->
<form id="callmeback" name="callmeback" method="post" action="<cfoutput>#CurrentPage#</cfoutput>">
<label for="visitorname">Your Name</label>
<input type="text" name="visitorname" id="visitorname" />
<br />
<label for="visitorphone">Your Phone</label>
<input type="text" name="visitorphone" id="visitorphone" />
<br />
<label for="visitoremail">Your Email</label>
<input type="text" name="visitoremail" id="visitoremail" />
<br />
<label for="regarding">This is Regarding</label>
<input type="text" name="regarding" id="regarding" />
<br />
<input type="submit" name="callMeButton" value="Call Me">
</form>

Create the Basic Form Processing

So now we want to process our form. We will put the code for this between "setting current page" and "setting form action". (NOTE: When a visitor accesses the page, cf will test to see if the form has been submitted. If the form has been submitted the, it will be processed and the visitor sent to the thankyou page. If the form has not been submitted, then the Call Me Back form will be displayed.)

<!--- if form is submited then process form --->

<cfif StructKeyExists(Form,"callMeButton")>

<!--- substitute correct cell number, mail server etc --->
<cfmail to="1234567890@message.alltel.com"
from="callmeback@youremail.com"
<!--- while your at it, send a cc to your email --->
cc = "youremail@youremail.com"
subject="Call Me Back Alert"
server="mail.mailserver.com">
<!--- keep message short due to restriction on number of characters --->
call #form.visitorname# at #form.visitorphone#
regarding #form.regarding#
Contact Email is: #form.visitoremail#
</cfmail>

<!--- if you want, send confirmation email to visitor --->

<cfmail to="#form.visitoremail#"
from="callmeback@youremail.com"
subject="Your Call Me Back Request "
server="mail.mailserver.com">
Thank you #form.visitorname# for your call back request.
A representative will call shortly at #form.visitorphone#
regarding #form.regarding#
Etc...
</cfmail>

<!--- Once the message has been sent, go to thankyou page confirmation --->
<cflocation url="thankyou.cfm">

</cfif>

OK, that's the basics. Important: You still need to add form field validation (as well as make it pretty :D)

Completed callmeback.cfm

<!--- if form is submited then process form --->

<cfif StructKeyExists(Form,"callMeButton")>

<!--- substitute correct cell number, mail server etc --->
<cfmail to="1234567890@message.alltel.com"
from="callmeback@youremail.com"
<!--- while your at it, send a cc to your email --->
cc = "youremail@youremail.com"
subject="Call Me Back Alert"
server="mail.mailserver.com">
<!--- keep message short due to restriction on number of characters --->
call #form.visitorname# at #form.visitorphone#
regarding #form.regarding#
Contact Email is: #form.visitoremail#
</cfmail>

<!--- if you want, send confirmation email to visitor --->

<cfmail to="#form.visitoremail#"
from="callmeback@youremail.com"
subject="Your Call Me Back Request "
server="mail.mailserver.com">
Thank you #form.visitorname# for your call back request.
A representative will call shortly at #form.visitorphone#
regarding #form.regarding#
Etc...
</cfmail>

<!--- Once the message has been sent, go to thankyou page confirmation --->
<cflocation url="thankyou.cfm">

</cfif>

<p><b>Call Me Back Form</b></p>

<!--- setting form action to CurrentPage --->
<form id="callmeback" name="callmeback" method="post" action="<cfoutput>#CurrentPage#</cfoutput>">
<label for="visitorname">Your Name</label>
<input type="text" name="visitorname" id="visitorname" />
<br />
<label for="visitorphone">Your Phone</label>
<input type="text" name="visitorphone" id="visitorphone" />
<br />
<label for="visitoremail">Your Email</label>
<input type="text" name="visitoremail" id="visitoremail" />
<br />
<label for="regarding">This is Regarding</label>
<input type="text" name="regarding" id="regarding" />
<br />
<input type="submit" name="callMeButton" value="Call Me">
</form>

Resources:

 

 

About This Tutorial
Author: Megan Garrison
Skill Level: Beginner 
 
 
 
Platforms Tested: CFMX7
Total Views: 100,625
Submission Date: November 15, 2007
Last Update Date: June 05, 2009
All Tutorials By This Autor: 4
Discuss This Tutorial
  • Nice article. Very helpful. There is also a video tutorial and free sms contact enabled form at http://www.easykiss123.com/?p=32

  • it was helpful

Advertisement


Website Designed and Developed by Pablo Varando.