On 1/1/2020, Auron Software B.V. acquired ActiveXperts SMS Component and will continue developing, selling and supporting the product under it's own brand name Auron SMS Component. Maintenance contracts will be continued directly by Auron Software as of 1/1/2020.

ColdFusion sample - Send SMS text through an HTTP provider

The ActiveXperts SMS Component is a software development kit (SDK) to enhance an application or script with SMS or Pager functionality. SMS messages can be sent/received using a GSM modem, an SMPP provider or an HTTP compliant SMSC.


In this example we are going to use create a ColdFusion project to send SMS messages. This demo project will ask the user to give a phone number and a message body in the web interface.

A subscription to an HTTP provider is required. For this demo you can send a limited number of messages through our own gateway.

Step 1: Download and install the ActiveXperts SMS Component

Download the ActiveXperts SMS Component from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.

Step 2: Create a new ColdFusion document

Create a new blank webdocument with the ".cfm" extention. First of all we are going to build the form whitch commands and properties of the device can be filled in. Then we are going to make a source code that connects to the device.

Step 3: Implementation

To use HTTP-POST in ColdFusion, we need to use the Http and SmsMessage objects for sending SMS messages. We also need the constants object.

<cfobject type="com" Action="Create"class="AxSms.Http"          name="objHttp" >
<cfobject type="com" Action="Create"class="AxSms.Constants"  name="objSmsConstants">
<cfobject type="com" Action="Create"class="AxSms.Message"    name="objSmsMessage">

Step 4: Create a form

To send a SMS message using HTTP the following data is required by the component:

Step 5: Collect the submitted data and send the message.

If the form is submitted and the data is succesfully collected, the message needs to be sent to the recipient. The Message object and the HttpPost object need to be configured to send a message. The message object contains all message data like the message type, the message body and the recipient number. The url, the port, the errorresponse and so on are stored in the HttpPost object. If all required information is submitted to the HttpPost object, a connection is made.

Step 6: Send SMS message

The following code shows how to send an SMS message using the data that was stored in the 'objSmsMessage' and 'objSmsConstants' objects.

objHttp.SendSms(obj, objSmsConstants.MULTIPART_OK);

Appendix: Full source code

Following you can find the full source code which is also included in the ActiveXperts SMS Component package.

<cfobject type="com" Action="Create"class="AxSms.Http"       name="objHttp" >
<cfobject type="com" Action="Create"class="AxSms.Constants"  name="objSmsConstants">
<cfobject type="com" Action="Create"class="AxSms.Message"    name="objSmsMessage">

<cfregistry action = "get" 
  branch = "HKEY_LOCAL_MACHINE\SOFTWARE\ActiveXperts\SMS Component"
  entry = "InstallRoot"
  variable = "strInstrallRoot"
  type = "string"> 

  strResult = "n/a";
  strLastResponse = "";
  objHttp.LogFile = "C:\Windows\Temp\ActiveXperts.Http.log";
  if (IsDefined("Form.btnSendMessage"))

    objSmsMessage.BodyFormat = objSmsConstants.BODYFORMAT_TEXT;
    objSmsMessage.Body = Form.txtBody;
    objSmsMessage.ToAddress = Form.txtToAddress;
    objHttp.Url = Form.txtUrl;
    obj = objSmsMessage;
    objHttp.SendSms(obj, objSmsConstants.MULTIPART_OK);
    strResult = objHttp.LastError & ': ' & objHttp.GetErrorDescription(objHttp.LastError);
    strLastResponse = objHttp.LastResponseCode;    
  function GetSmsDemoAccountInfo ()
    // NOTE: during installation of the ActiveXperts SMS Component, a unique login and password 
    // is created for you.
    // This login and password can be used to send a few SMS messages through the 
    // smpp.activexperts-labs.com gateway, for free
    // The 'GetSmsDemoAccountInfo' reads the unique account info from a file that was created 
    // during installation
    strDirectory = strInstrallRoot & "\Utilities\activexperts-labs.txt";
    objFile = FileOpen(strDirectory, "read");
    strAccount = FileReadLine(objFile);
    strPassword = FileReadLine(objFile);
    strInfo = "post.activexperts-labs.com:8080/sendsms/default.asp";
    strInfo = strInfo & "?username=" & strAccount;
    strInfo = strInfo & "&password=" & strPassword;
    strInfo = strInfo & "&text=" & objSmsConstants.HTTP_PLACEHOLDER_BODY;
    strInfo = strInfo & "&to=" & objSmsConstants.HTTP_PLACEHOLDER_TOADDRESS;
    return strInfo;

<html xmlns="http://www.w3.org/1999/xhtml" >
  <title>ActiveXperts SMS Component Demo</title>
  <link rel="Stylesheet" type="text/css" href="css/Layout.css" />
    </div><!-- /header -->

      <h1>SMS Component Coldfusion HTTP Sample</h1>
      <hr />
      The HTTP protocol is used for medium volume SMS messaging. Messages are first routed to the 
      service provider via Internet/VPN. The provider delivers the messages to the recipient's 
      phone. If you are not subscribed to a provider, use the ActiveXperts gateway to send 10 SMS 
      messages for free. 
      <form action="http.cfm" method="post">
        <h2>SMS Component:</h2>
        <h3>Build: #objHttp.Build#; Module: #objHttp.Module#</h3>
        <!-- Connection URL -->
        <label for="Url">Connection URL:</label>
          <input type="text" id="Url" name="txtUrl" 
            value="#GetSmsDemoAccountInfo()#" />
        <!-- Empty row -->
        <!-- ToAddress -->
        <label for="ToAddress">ToAddress:</label>
          <input type="text" id="ToAddress" name="txtToAddress" value="[ToAddress]" />
          <a href="https://www.activexperts.com/support/sms-component/?kb=Q4200015" target="_blank">
            Recipient number format
        <!-- Body -->
        <label for="Body">Body:</label>
          <textarea id="Body" name="txtBody" style="height:55px;">
            Hello world send from ActiveXperts SMS Component!
        <!-- Send button -->
          <input type="submit" name="btnSendMessage" value="Send SMS Message!" />
        <!-- Empty row -->
        <!-- Result -->
        <label for="Result"><b>Result:</b></label>
          <input type="text" id="Result" name="txtResult 
            value="#strResult#" />
        <!-- Last Response -->
        <label for="Response">Last Response:</label>
          <input type="text" id="Response" name="txtLastResponse" 
            value="#strLastResponse#" />
        This demo uses the ActiveXperts SMS Component, an 
        <a href="https://www.activexperts.com" target="_blank">ActiveXperts Software</a>
        <br />
        <a href="index.cfm">Back to main page</a>
    </div><!-- /container -->
        © 2011 <a href="https://activexperts.com" target="_blank">
          Active<font color="#CCC000000">X</font>perts Software B.V.</a> All rights reserved.
  <a href="https://activexperts.com/activexperts/contact" target="_blank">Contact Us</a> |
  <a href="https://activexperts.com/activexperts/termsofuse" target="_blank">Terms of Use</a> |
  <a href="https://activexperts.com/activexperts/privacypolicy" target="_blank">Privacy Policy</a>
    </div><!-- /footer -->
  </div><!-- /maincontainer -->

You can download the full source code of this project from the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/sms-component. There are many other working samples included with the product or on the FTP site.

NOTE: Demo Projects are created with Microsoft Visual Studio 2008

The ActiveXperts SMS Component project ships with a set of Microsoft Visual Studio .NET samples. The projects are created with Microsoft Visual Studio 2008.

Users with a later version of Microsoft Visual Studio can open such a project. The Visual Studio Conversion Wizard will guide you through the process of converting the project to the version used.