Shortcut Menu

Skip

Main Navigation

Choose your language


ActiveXperts SMS and MMS Toolkit Add SMS and MMS capabilities to any Windows or .NET application

Using the SMS and MMS Toolkit with ASP 2.x

The SMS and MMS Toolkit is a software development kit (SDK) to enhance an application or script with SMS, MMS and Pager functionality. SMS messages can be sent using a GSM/GPRS modem, an SMPP provider, an HTTP compliant SMS provider or using a standard dialup or fixed-line SMS modem. MMS messages can be sent via a GSM/GPRS modem (MM1), an SMTP server (MM4) or an XML/SOAP compliant provider (MM7).

SMS features:

  • Send and receive numeric- and alphanumeric text SMS messages
  • Verify delivery of outgoing SMS messages
  • Support for multimedia SMS messages, including ringtones, pictures and logo's
  • Support for WAP Push, WAP Bookmarks, vCards, voicemail/e-mail/fax/MMS indications
  • Support for Unicode, to support foreign languages like Arabic, Chinese, Hebrew, etc.
  • Support for multi-part messages, to allow messages longer than 160 characters
  • Support for GSM modems, GSM phones, SMS/HTTP providers, SMPP (Short Message Peer to Peer) providers, TAP/XIO and UCP dial-in SMSC providers
  • Support Multi-threading environments. The component is thread-safe, which means it can be used in a multi-threaded environment
  • Samples included for various development platforms: MS Visual Basic, MS Visual Basic .NET, MS Visual C++, MS Visual Studio C# .NET, ASP, ASP .NET, Borland Delphi, Borland C++ Builder, Windows Powershell ColdFusion and more

MMS features:

  • Support for many multimedia formats incl.: JPG, GIF, PNG, BMP, WBMP, TIF, WAV, MP3, MIDI, AC3, GP3, AVI, MPG, MP4, VCARD, VCALENDAR, JAR and more
  • Support for MM1 (MMS over WAP), MM4 (MMS over SMTP) and MM7 (MMS over HTML/SOAP)

Pager features:

  • Send alpha-numeric Pager messages through SNPP

This document describes how the SMS and MMS Toolkit can be integrated into ASP projects.

Step 1: Download and install the SMS and MMS Toolkit

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

Step 2: Create a new Web Site

First, create a new directory on the IIS Server's file system. This directory will hold the ASP later on.

From the 'Start menu', click on 'Administrative Tools' and click on 'Internet Information Services (IIS) Manager'. Right-click on the 'Web Sites' container and choose 'New->Web Site':

GSM ASP

(Click on the picture to enlarge)

The 'Web Site Creation Wizard' is shown, guiding you thorugh the process of creating a new web site. Provide all necessary information:

  • Description - a froendly description of the new site;
  • IP / Port / Host Header - choose your preferred way to distinguish between other web sites on the server;
  • Path - select the directory that will store the ASP file(s);
  • Web Site Access Permissions - in the Web Site Access Permissions dialog, enable 'Read' and 'Run scripts (such as ASP)';

You're now able to write an ASP script to send/receive e-mail using SMS and MMS Toolkit.

Step 3: Create the SMS and MMS Toolkit objects in ASP

Create a new ASP script called DEFAULT.ASP in the directory that was created in Step2, using your favorite editor. On top of the ASP code, insert the following lines to declare and create the SmsProtocolGsm object:

   <object runat=server progid="ActiveXperts.SmsProtocolGsm" id=objGsmProtocol></object>

Insert the following line to declare and create the SmsMessage object:

   <object runat=server progid="ActiveXperts.SmsMessage" id=objSmsMessage></object>
Insert the following line to declare and create the SmsConstants object:
   <object runat=server progid="ActiveXperts.SmsConstants" id=objSmsConstants></object>

Step 4: Test a small piece of ASP

Now, test if your new web site is working well with ActiveEmail using your browser. If you are using Microsoft Internet Explorer, it is recommended to disable friendly error message because this default setting doesn't show any ASP error message, making it hard to debug if there are any problems:

  • Choose' Internet Options' from the 'Tools' menu;
  • Select the 'Advanced' tab;
  • In the 'Browsing' folder, de-select the 'Show friendly HTTP error messages' option;
  • Click 'OK' to close the dialog.

Now, use the following piece of code in your DEFAULT.ASP page:

   <object runat=server progid="ActiveXperts.SmsConstants"       id=objSmsConstants ></object>
   <object runat=server progid="ActiveXperts.SmsProtocolGsm"     id=objGsmProtocol></object>
   <object runat=server progid="ActiveXperts.SmsMessage"         id=objSmsMessage></object>

   <html>
   <head>
   <title>SMS and MMS Toolkit Demo</title>
   </head>

   <body>

   SMS and MMS Toolkit version: <% = objGsmProtocol.Version %><br>
   SMS and MMS Toolkit expiration date: <% = objGsmProtocol.ExpirationDate %>

   </body>

   </html>

And test it with your favorite browser. The result should be like this:


(Click on the picture to enlarge)

Step 5: Send and/or receive SMS messages

You can now send and/or receive SMS messages.

The following ASP code shows how to send a SMS message using a connected GSM phone or modem:

<object runat=server progid="ActiveXperts.SmsProtocolGsm" id=objGsmProtocol> </object>
<object runat=server progid="ActiveXperts.SmsConstants"   id=objSmsConstants> </object>
<object runat=server progid="ActiveXperts.SmsMessage"     id=objSmsMessage> </object>
<html>
<head>
<META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;CHARSET=utf-8" >
<title>ActiveXperts SMS and MMS Toolkit - ASP Sample</title>
</head>
<body>
<font face="sans-serif" size="2">
<hr size="1" color="707070">
<b><font size="4">ActiveXperts SMS and MMS Toolkit ASP Sample</font></b>
<br>
<br>
<b>Send an SMS message to a recipient through a GSM phone or modem connected to your webserver.</b>
<hr size="1" color="707070">
<br>

<%
If Request( "BUTTON_SEND" ) <> "" Then
    objGsmProtocol.LogFile          = "C:\\SmsLogAsp.txt" 
    objGsmProtocol.Device           = Request( "STR_DEVICENAME" )
    objGsmProtocol.DeviceSpeed      = Request( "NUM_DEVICESPEED" )

    objSmsMessage.Recipient         = Request( "STR_RECIPIENT" )
    objSmsMessage.Data              = Request( "STR_MESSAGETEXT" )

    If ( Request ( "CHECK_UNICODE" ) = "on" ) Then
       objSmsMessage.Format = objSmsConstants.asMESSAGEFORMAT_UNICODE
    End If

    objGsmProtocol.Send( objSmsMessage )
%>
    <% If objGsmProtocol.LastError = 0 Then %>
        <h2>Your message was submitted successfully.</h2>
    <% Else %>
        <b><font size="2" color="700000">
        Failed to send message, ERROR#<% = objGsmProtocol.LastError %>: <% = objGsmProtocol.GetErrorDescription( objGsmProtocol.LastError ) %>.
        </font></b><br>
    <% End If %>
<%
Else
%>    
    <form action="default.asp" method="post">
    <table border="0" bgcolor="#f0f0f0">
        <tr>
            <td width="10"> </td>
            <td width="120" valign="top">Device Name:</td>
            <td width="450">
            <select size="1" name="STR_DEVICENAME">
            <% nDevices = objGsmProtocol.GetDeviceCount() %>
            <% For iDevice = 0 To nDevices - 1 %>
                <% If iDevice = 0 Then %>
                     <option selected><% = objGsmProtocol.GetDevice ( iDevice ) %></option>
                <% Else %>
                     <option><% = objGsmProtocol.GetDevice ( iDevice ) %></option>
                <% End If %>
            <% Next %>
            <% If nDevices = 0 Then %>
                <option selected>COM1</option>
            <% Else %>
                <option>COM1</option>
            <% End If %>
            <option>COM2</option>
            <option>COM3</option>
            <option>COM4</option>
            </select>
            <br>
            </td>
       </tr>

       <tr>
            <td> </td>
            <td>Device Speed:</td>
            <td>
            <select size="1" name="NUM_DEVICESPEED">
            <option selected value=0>Default</option>
            <option value=1200>1200</option>
            <option value=2400>2400</option>
            <option value=9600>9600</option>
            <option value=19200>19200</option>
            <option value=38400>38400</option>
            <option value=57600>57600</option>
            <option value=115200>115200</option>
            </select>
            </td>
        </tr>
       
        <tr>
            <td valign="top"> </td>
            <td valign="top">Recipient:</td>
        <td>
            <input size=50 type=text name="STR_RECIPIENT" value="<enter recipient number>"><br>
        </td>
        </tr>
        <tr>
            <td valign="top"> </td>
            <td valign="top">Message:<br>(max. 160 chars)</td>
        <td>
            <textarea rows="3" name="STR_MESSAGETEXT" cols="65">Hello, world</textarea>
        </td>
        </tr>
        <tr>
        <td valign="top"> </td>
        <td valign="top"> </td>
        <td><input type="checkbox" name="CHECK_UNICODE">Send message as Unicode</td>
        </tr>
        </table>
        <br>
    <input type="submit" value="Send Message" name="BUTTON_SEND" >
    <br>
    <br>
    <b>IMPORTANT:</b> Please press the button <b>only once</b>, and allow some time for the SMS to be processed.
    </form>
<% End If %>
<br>
</body>
</html>

There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/mobile-messaging-component.