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

Using The MMS Toolkit with VBScript (MM4 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 VBScript projects.

Step 1: Download and install The 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 script

Create a new script using your favorite editor. You can simply use notepad. However, a VBScript editor is recommended, so you can browse through objects, objects properties and object functions.

You're now able to write a more advanced VBScript script to send MMS using MMS Toolkit.

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

Create a new VBScript file called DEMO.VBS. It is recommended to insert the following line on top of your code:

Option Explicit

This statement requires that all variable names be defined (with the Dim statement), to avoid simple typos that can cause incredible headaches and long debugging sessions for something that should have never happened.

Now, declare the SMS and MMS Toolkit objects:

Dim objMm4Protocol
Dim objMmsMessage
Dim objMmsConstants
Dim objMmsSlide

Create the MMS objects like this:

Set objMm4Protocol      = CreateObject( "ActiveXperts.MmsProtocolMm4" )
Set objMmsMessage       = CreateObject( "ActiveXperts.MmsMessage" )
Set objMmsConstants     = CreateObject( "ActiveXperts.MmsConstants" )
Set objMmsSlide         = CreateObject( "ActiveXperts.MmsSlide" )

Now, add the following lines to the file to have your fist MMS Toolkit VBScript program:

WScript.Echo "Version: " & objMm4Protocol.Version
WScript.Echo "Expiration Date: " & objMm4Protocol.ExpirationDate

Step 4: Send MMS messages

You can now send MMS messages.

The following VBScript code shows how to send a MMS message using SMTP:

Option Explicit

Dim objMmsConstants, objMmsMessage, objMm4Protocol, objMmsSlide

Set objMm4Protocol                 = CreateObject ( "ActiveXperts.MmsProtocolMm4" )
Set objMmsMessage                  = CreateObject ( "ActiveXperts.MmsMessage"     )
Set objMmsSlide                    = CreateObject ( "ActiveXperts.MmsSlide"       )
Set objMmsConstants                = CreateObject ( "ActiveXperts.MmsConstants"   )

' MMSlide: Add duration, attachments(s) and text(s)
objMmsSlide.Clear
objMmsSlide.Duration               = 10          'Display this screen for 10 seconds
objMmsSlide.AddAttachment          "logo.gif"
objMmsSlide.AddText                "The ActiveXperts logo"

' MmsMessage: Set properties
objMmsMessage.Clear    
objMmsMessage.Subject              = "MMS Message"
objMmsMessage.AddRecipient         AskRecipient()

' MmsMessage: Set advanced properties
objMmsMessage.Class                = objMmsConstants.asMMS_CLASS_PERSONAL 
objMmsMessage.Priority             = objMmsConstants.asMMS_PRIORITY_HIGH

' MmsMessage: Add the slide created above. Note:You can add multiple slides
objMmsMessage.AddSlide             ( objMmsSlide )

' MmsProtocolMm4: Set Provider
objMm4Protocol.ProviderHost        = "192.168.31.93"
objMm4Protocol.ProviderPort        = 25

objMm4Protocol.ProviderAccount     = "mm4"
objMm4Protocol.ProviderPassword    = "secret"

'objMm4Protocol.ProviderDomain     = "activexperts.dom"
'objMm4Protocol.ProviderMM4Version = objMmsConstants.asMMS_VERSION_5_2_0;

' MmsProtocolMm4: Set log file
objMm4Protocol.LogFile             = "mm4log.txt"

' MmsProtocolMm4: send now
objMm4Protocol.Send                ( objMmsMessage )

WScript.Echo "Send, result: " & objMm4Protocol.LastError & " (" & _ 
             objMm4Protocol.GetErrorDescription ( objMm4Protocol.LastError ) & ")" & vbCrLf 
'WScript.Echo "Provider response: " & objMm4Protocol.ProviderResponse & vbCrLf
'WScript.Echo "MessageID: " & objMm4Protocol.MessageId

' MmsProtocolMm4: ready
WScript.Echo "Ready."

' ***************************************************************************
' Function AskRecipient
' ***************************************************************************
Function AskRecipient
   Dim strRecipient
   Do
       strRecipient = inputbox( "Enter a recipient ( mobile number or e-mail address )", "Input" )
   Loop until strRecipient <> ""
   AskRecipient = strRecipient
End Function

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.