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 SMS and MMS Toolkit with ASP 2.x (MM1 Connection)

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':

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 MMS content using the ActiveXperts 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 the MMS objects:

<%
   Dim objMmsConstants
   Dim objMm1Protocol
   Dim objMmsMessage
   Dim objMmsSlide
%>

Insert the following lines to create the objects:

<%
   Set objMmsConstants  = Server.CreateObject ( "ActiveXperts.MmsConstants" )
   Set objMm1Protocol   = Server.CreateObject ( "ActiveXperts.MmsProtocolMm1" )
   Set objMmsMessage    = Server.CreateObject ( "ActiveXperts.MmsMessage" )
   Set objMmsSlide      = Server.CreateObject ( "ActiveXperts.MmsSlide" )
%>

Step 4: Test a small piece of ASP

Now, test if your new web site is working well with the SMS and MMS Toolkit 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:

 
<%
   Dim objMmsConstants
   Dim objMm1Protocol
   Dim objMmsMessage
   Dim objMmsSlide
%>

<%
   Set objMmsConstants  = Server.CreateObject ( "ActiveXperts.MmsConstants" )
   Set objMm1Protocol   = Server.CreateObject ( "ActiveXperts.MmsProtocolMm1" )
   Set objMmsMessage    = Server.CreateObject ( "ActiveXperts.MmsMessage" )
   Set objMmsSlide      = Server.CreateObject ( "ActiveXperts.MmsSlide" )
%>

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

   <body>
    MMS Toolkit version:         <% = objMm1Protocol.Version %><br>
    MMS Toolkit expiration date: <% = objMm1Protocol.ExpirationDate %><br>
   </body>
  </html>

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

ASP

(Click on the picture to enlarge)

Step 5: Receive MMS messages

You can now receive MMS messages using a connected GSM GPRS/EDGE/UMTS modem.

The following ASP code generates a website where incoming messages are listed on a webpage.

The demo can be run from a client connecting to the ASP webserver. The client does not need any additional hardware.

The modem has to be connected to the webserver.

The following ASP code shows how to receive MMS messages:

default.asp
<% Option Explicit %>

<%

' ********************************************************************
'
' Receive an MMS message through a connected GPRS/UMTS modem.
'
' Note:
'
'    The GPRS/UMTS phone or modem must be connected to your PC
'    using an USB or serial datacable, IR or BlueTooth.
'
' (c) Copyright 2008 by ActiveXperts Software - www.activexperts.com
'
' ********************************************************************

%>

<%
  ' Create objects
  Dim objConnection
  Set objConnection = CreateObject ( "ActiveXperts.MmsProtocolMm1" )
%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>ActiveXperts SMS and MMS Toolkit - Receive MMS Messages</title>
<style type="text/css">
<!--
td,body{
  font-size: x-small;
}
-->
</style>

</head>
<body style="font-family: verdana; font-size: x-small;">

<hr size="1" color="#707070">
<p style="font-weight: bold; font-size: 13pt;">ActiveXperts SMS and MMS Toolkit MMS MM1 ASP Sample</p>
<p>Receive an MMS message to a recipient through a GSM/GPRS Phone or Modem connected to your PC.</p>
<p>For more details about using SMS and MMS Toolkit with ASP, 
<a target="_blank" href="http://www.activexperts.com/support/kb/index.asp?productcode=004&idcategory=457">click here</a>.</p>
<hr size="1" color="#707070">

<form action="receive.asp" method="post">

<table border="0" bgcolor="#f0f0f0">
  <tr>
    <td width="120">Device</td>
    <td>
      <select name="Device">
        <%
           Dim arrDevices, strDevice, i
           arrDevices = getDevices

           for i = 0 to ubound(arrDevices)
              strDevice = arrDevices(i)
              Response.Write "<option value='" & strDevice & "'>" & strDevice & "</option>" & vblf
           next
        %>	
      </select>
    </td>
  </tr>
  <tr>
    <td width="120">APN</td>
    <td width="450"><input type="text" style="width: 400px;" name="APN"></td>
  </tr>
  <tr>
    <td width="120">APN Account</td>
    <td width="450"><input type="text" style="width: 400px;" name="APNAccount"></td>
  </tr>
  <tr>
    <td width="120">APN Password</td>
    <td width="450"><input type="text" style="width: 400px;" name="Password"></td>
  </tr>
  <tr>
    <td width="120">WAP Gateway</td>
    <td width="450"><input type="text" style="width: 400px;" name="Gateway"></td>
  </tr>
  <tr>
    <td width="120">MMSC</td>
    <td width="450"><input type="text" style="width: 400px;" name="MMSC"></td>
  </tr>
  <tr>
    <td width="120">Logfile</td>
    <td width="450"><input type="text" style="width: 400px;" name="Logfile"></td>
  </tr>
  <tr>
    <td width="120">Result</td>
    <td width="450"></td>
  </tr>
</table>

<p><input type="submit" name="SubmitButton" value="Get messages"></p>

<hr size="1" color="#707070">

<p style="font-family: verdana;">
This demo uses the ActiveXperts SMS and MMS Toolkit, an <a href="http://www.activexperts.com">ActiveXperts Software</a> product.<br>
<a href="../index.htm">Click here</a> to return to the ASP sample menu page.<br>
</p>

</form>

</body>
</html>


<%
' ***************************************************************************
' Function GetDevices
' ***************************************************************************
Function getDevices()
  Dim nDeviceCount, arrResults()
      nDeviceCount = objConnection.GetDeviceCount

  If( nDeviceCount <> 0 ) Then
    Dim i, nIndex
    nIndex = objConnection.GetDeviceCount - 1

    ReDim arrResults(nIndex)
    For i = 0 To ( objConnection.GetDeviceCount - 1 )
      arrResults(i) = objConnection.GetDevice(i)
    Next
  Else
    Redim arrResults(0)
    arrResults(0) = "No devices connected to computer."
  End If

  getDevices = arrResults
End Function
%>
receive.asp
<% Option Explicit %>

<%

' ********************************************************************
'
' Receive an MMS message through a connected GPRS/UMTS modem.
'
' Note:
'
'    The GPRS/UMTS phone or modem must be connected to your PC
'    using an USB or serial datacable, IR or BlueTooth.
'
' (c) Copyright 2008 by ActiveXperts Software - www.activexperts.com
'
' ********************************************************************

%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>ActiveXperts SMS and MMS Toolkit - Receive MMS Messages</title>
<style type="text/css">
<!--
td,body{
  font-size: x-small;
}
-->
</style>

</head>
<body style="font-family: verdana; font-size: x-small;">

<hr size="1" color="#707070">
<p style="font-weight: bold; font-size: 13pt;">ActiveXperts SMS and MMS Toolkit MMS MM1 ASP Sample</p>
<p>Receive an MMS message to a recipient through a GSM/GPRS Phone or Modem connected to your PC.</p>
<p>For more details about using SMS and MMS Toolkit with ASP, 
<a target="_blank" href="http://www.activexperts.com/support/kb/index.asp?productcode=004&idcategory=457">click here</a>.</p>
<hr size="1" color="#707070">

<% ReceiveMessages() %>


<hr size="1" color="#707070">

<p style="font-family: verdana;">
This demo uses the ActiveXperts SMS and MMS Toolkit, an <a href="http://www.activexperts.com">ActiveXperts Software</a> product.<br>
<a href="../index.htm">Click here</a> to return to the ASP sample menu page.<br>
</p>

</body>
</html>


<%
Sub ReceiveMessages()
  ' Declare objects
  Dim objConstants, objMessage, objConnection, objSlide

  ' Declare variables
  Dim n, nCount
  Dim m, nAttachments

  ' Create objects
  Set objConnection                 = CreateObject ( "ActiveXperts.MmsProtocolMm1" )
  Set objConstants                  = CreateObject ( "ActiveXperts.MmsConstants" )


  Response.Write( "<table border='0' bgcolor='#f0f0f0'>" & vbLf )
  Response.Write( "  <tr>" & vbLf )
  Response.Write( "    <td width='120'>Device</td>" & vbLf )
  Response.Write( "    <td>" & Request("Device") & "</td>" & vbLf )
  Response.Write( "  </tr>" & vblf )

  objConnection.Device              = Request("Device")
  If( objConnection.Device = "" ) Then
     Response.Write( "  <tr>" & vbLf )
     Response.Write( "    <td> </td>" & vbLf )
     Response.Write( "    <td>No TAPI devices available</td>" & vbLf )
     Response.Write( "  </tr>" & vbLf )
     Response.Write( "</table>" )
     Exit Sub
  End If

  ' Set 'LogFile'
  objConnection.LogFile             = Request("Logfile")
  
  ' Set provider properties GPRS APN, WAP Gateway and MMSC Server Address.
  ' Please check http://www.activexperts.com/mmstoolkit/mmsclist, or ask your provider for
  ' your provider's settings
  
  
  ' Set APN
  objConnection.ProviderAPN         = Request("APN")

  ' Set APN Account
  objConnection.ProviderAPNAccount  = Request("APNAccount")

  ' Set APN Password
  objConnection.ProviderAPNPassword = Request("Password")

  ' Set WAP Gateway
  objConnection.ProviderWAPGateway  = Request("Gateway")

  ' Set MMSC URL
  objConnection.ProviderMMSC        = Request("MMSC")

  ' Download MMS notifications from SIM card
  nCount = objConnection.CountReceivedMessages


  Response.write( "  <tr>" & vbLf )
  Response.write( "    <td width='120'>Counting messages</td>" & vbLf )
  Response.write( "    <td width='450'>" &_
                  "Result: " & objConnection.LastError & " (" & _ 
                   objConnection.GetErrorDescription ( objConnection.LastError ) & ")" &_
                  "</td>" & vbLf )
  Response.Write( "  </tr>" & vblf )

  If ( objConnection.LastError <> 0 ) Then
    Exit Sub
  End If

  If ( nCount = 0 ) Then
    Response.write( "  <tr>" & vbLf )
    Response.write( "    <td width='120'>Messages:</td>" & vbLf )
    Response.write( "    <td width='450'>No new messages waiting...</td>" & vblf)
    Response.write( "  </tr>" & vbLf )
    Response.write( "</table>" & vbLf )
    Exit Sub
  End If

  objConnection.Connect

  Response.Write( "  <tr>" & vbLf )
  Response.Write( "    <td width='120'>Connecting</td>" & vbLf )
  Response.Write( "    <td width='450'>Result: " & objConnection.LastError & " (" &_ 
                 objConnection.GetErrorDescription ( objConnection.LastError ) & ")" )
  Response.Write( "  </tr>" & vbLf )


  If ( objConnection.LastError <> 0 ) Then
    Response.Write("</table>")
    Exit Sub
  End If

  For n = 0 To nCount - 1
    On Error Resume Next
      Set objMessage = objConnection.GetMessage ( n )
    On Error Goto 0
   
    If ( objConnection.LastError = 0 ) Then
      Response.Write( "  <tr>" & vbLf )
      Response.Write( "    <td colspan=2>New MMS message received from: " & objMessage.From & "</td>" & vbLf )
      Response.Write( "  </tr>" )
         
      On Error Resume Next
        Set objSlide = objMessage.GetFirstSlide ()
      On Error Goto 0
         
      While ( objMessage.LastError = 0 ) 
        
        nAttachments = objSlide.CountAttachments ()
            
        For m = 0 To nAttachments - 1
          Response.Write( "  <tr>" & vbLf )
          Response.Write( "    <td width='120'>Attachment found:</td>" & vbLf )
          Response.Write( "    <td width='450'>" &_ 
                                         objSlide.GetAttachmentName ( m ) &_
                                         "</td>" & vbLf )
          Response.Write( "  </tr>" )
        Next
            
        On Error Resume Next
          Set objSlide = objMessage.GetNextSlide ()
        On Error Goto 0
      WEnd
    End If
  Next

  ' GPRS/UMTS Disconnect
  objConnection.Disconnect

  Response.Write( "</table>" )


End Sub
%>

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.