ActiveXperts Mobile Messaging Toolkit Manual

© 1999-2011 ActiveXperts Software B.V.  contact@activexperts.com

 

1. Introduction

1.1. Introduction

The ActiveXperts Mobile Messaging Toolkit enables application developers to add SMS, E-mail and Pager functionality to their applications in a matter of minutes.

The Mobile Messaging Toolkit is an ActiveX/COM component. This component registers a number of objects which enable SMS, E-mail and Pager functionality. With this toolkit you can send as well as receive SMS messages through:

  • GSM Modem
  • SMPP Provider
  • HTTP SMS provider

The Mobile Messaging Toolkit can also be used to setup you own SMPP Server or Gateway that accepts incoming SMPP connections.

It supports sending and receiving e-mail messages through:

  • POP3
  • SMTP

It supports sending pager messages through:

  • SNPP Provider (alpha-numeric paging)

The Mobile Messaging Toolkit can be used with the following operating systems:

  • Windows 2008
  • Windows 2003
  • Windows 7
  • Windows Vista
  • Windows XP

Since the Mobile Messaging Toolkit is completely exposed though ActiveX/COM components it can be used in the following programming languages:

  • Visual Basic .NET
  • Visual C# .NET
  • Visual Basic
  • Visual C++
  • Delphi
  • ASP .NET
  • ASP classic
  • PHP
  • VBScript
  • Javascript
  • VBA
  • ColdFusion
  • Any other development platform that supports ActiveX/COM components.

1.2. Features

SMS features:

  • Send through GSM modem devices
  • Send through SMPP 3.3/3.4 and 5.0 providers
  • Setup an SMPP 3.4 complient server
  • Send through HTTP and/or XML based API's
  • Send through dialup providers using TAP/XIO or UCP
  • Support for delivery reports
  • Supports text/unicode and binary SMS messages
  • Sending and receiving multipart messages
  • Sending and receiving messages to specific application ports
  • Templates for often used binary messages (WAPPush, vCards)

EMail features:

  • Send through SMTP providers
  • Receive from POP3 providers
  • Support for SSL / TLS encryption
  • Access to all e-mail header fields

Pager features:

  • Send alpha-numeric Pager messages through SNPP

Other features:

  • Troubleshooting facilities by tracing all protocol specific commands and responses
  • Samples included for various development platforms: MS Visual Basic, MS Visual Basic .NET, MS Visual C++, MS Visual C# .NET, ASP, ASP .NET and more
  • Support for multi-threading environments. The component is thread-safe as long as only one threads keeps and uses one instance of object(s)

1.3. Architecture

The core of Mobile Messaging Toolkit is an ActiveX/COM component that comes in a 32-bit and a 64-bit version:

  • AxMmCtl.dll The 'Mobile Messaging Toolkit COM Component' for 32-bit platforms;
  • AxMmCtlx64.dll The 'Mobile Messaging Toolkit COM Component' for 64-bit platforms;

The following objects are part of this component:

  • AxMmToolkit.Smpp This is the SMPP SMS protocol component
  • AxMmToolkit.SmppServer This is the SMPP SMS Server protocol component
  • AxMmToolkit.SmppSession This is the SMPP SMS Server session component
  • AxMmToolkit.Gsm This is the GSM modem SMS protocol component
  • AxMmToolkit.Http This is the HTTP SMS protocol component
  • AxMmToolkit.Dialup This is the Dialup SMS protocol component
  • AxMmToolkit.SmsMessage This is the SMS message component. SMS messages that are received and sent are kept in instances of this component
  • AxMmToolkit.SmsDataWapPush This is the WAPPush SMS message template. Use this to quickly generate binary formatted WAPPush messages
  • AxMmToolkit.SmsDatavCard This is the vCard SMS message template. Use this to quickly generate vCard formatted messages
  • AxMmToolkit.Tlv This is the TLV (Tag, Length, Value) component. It's only used with the SMPP component and can be part of an SMS message as well as a bind call
  • AxMmToolkit.Snpp This is the Pager SNPP protocol component
  • AxMmToolkit.PagerMessage This is the Pager message component. Pager messages that are received and send are kept in instances of this component
  • AxMmToolkit.Smtp This is the SMTP e-mail protocol component
  • AxMmToolkit.Pop3 This is the POP3 e-mail protocol component
  • AxMmToolkit.SmsConstants This component contains all constants that are used with SMS messages and the SMS protocols
  • AxMmToolkit.EmailConstants This component contains all constants that are used with EMail messages and the E-mail protocols

2. System Requirements

2.1. System Requirements

The Mobile Messaging Toolkit can be used by any of the following operating systems:

  • Windows XP, x86 (32-bit) and x64 (64-bit)
  • Windows 2003, x86 (32-bit) and x64 (64-bit)
  • Windows 2008, x86 (32-bit) and x64 (64-bit)
  • Windows Vista, x86 (32-bit) and x64 (64-bit)
  • Windows 7, x86 (32-bit) and x64 (64-bit)

NOTE: On 64 bits systems, you can run 32- and 64 bit programs. To integrate The Mobile Messaging Toolkit in a 64-bit (web) application of service, use the 64-bit AxMmCtlx64.dll. To integrate The Mobile Messaging Toolkit in a 32-bit (web) application of service, use the 32-bit AxMmCtl.dll.

2.2. Supported Platforms

The Mobile Messaging Toolkit can be used by any of the following programming languages:

  • Visual Basic .NET
  • Visual C# .NET
  • Visual Basic 5.x or higher
  • Visual C++ 5.x or higher
  • Delphi 6.x or higher
  • ASP .NET
  • ASP classic
  • PHP
  • ColdFusion
  • VBScript
  • Javascript
  • HTML
  • Any other development platform that supports ActiveX/COM components

3. Installation

3.1. Installation

To install the components simply run the MmToolkit.exe Setup program. The InstallShield wizard will guide you through the rest of the setup. The Setup program can perform the registration of the COM component for you. But it will also give you the opportunity to register the object yourself.

The Mobile Messaging Toolkit package consists of 3 components; any combination of components can be installed:

  • The Mobile Messaging Toolkit COM component
  • The Mobile Messaging Toolkit Help Files
  • The Mobile Messaging Toolkit Sample Files

The COM component, which is the interface to COM compliant applications, includes a 32 bit dll (AxMmCtl.dll) and 64 bit dll (AxMmCtlx64.dll)

4. How to use

4.1. Introduction

The following code snippets (VBScript) illustrate the use of the ActiveXperts Mobile Messaging Toolkit in various situations.

Send SMS using GSM modem

This sample will send out a single SMS messaging use the first TAPI device that's connected to the PC.

    Set objGsm = CreateObject("AxMmToolkit.Gsm")             ' Create the GSM protocol object
Set objMessage = CreateObject("AxMmToolkit.SmsMessage")  ' Create the SMS message object

' Show version information
Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
  objGsm.Build & "; Module " & objGsm.Module
WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf

objGsm.Logfile = "log.txt"                                ' Keep a session log

' Open the first connected device
sDevName = objGsm.FindFirstDevice
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  WScript.Quit 1
End If

' Compose an SMS message
' Set the 'ToAddress' to "+31122334455:1000" to send to application port 1000
objMessage.ToAddress = "+31122334455"
objMessage.Body = "This is a short text message"

' Send an SMS message through the connected GSM modem device
objGsm.SendSms objMessage
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  objGsm.Close
  WScript.Quit 1
End If

' Make sure to close the device to allow other applications to access it.
objGsm.Close
WScript.Echo "Done !"

Receive SMS using GSM modem

Read all SMS messages and status reports that are already on the SIM and leave them on the SIM card

  Set objGsm = CreateObject("AxMmToolkit.Gsm")             ' Create the GSM protocol object
Set objConst = CreateObject("AxMmToolkit.SmsConstants")  ' Create the global constants object
Set objMessage = CreateObject("AxMmToolkit.SmsMessage")  ' Create the SMS message object

' Show version information
Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
  objGsm.Build & "; Module " & objGsm.Module
WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf

objGsm.Logfile = "log.txt"                                ' Keep a session log

' Open the first connected device
sDevName = objGsm.FindFirstDevice
objGsm.Open sDevName
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)    
  WScript.Quit 1
End If

' Receive messages from the SIM card and leave them on the SIM card
objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
If objGsm.LastError <> 0 Then
  WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
  objGsm.Close
  WScript.Quit 1
End If

' Show all SMS messages
Set objMessage = objGsm.GetFirstSms
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objMessage.FromAddress
  WScript.Echo objMessage.Body
  Set objMessage = objGsm.GetNextSms
Wend

' Show all status reports
Set objReport = objGsm.GetFirstReport
While objGsm.LastError = 0
  WScript.Echo "Received from: " & objReport.FromAddress & _
    "; reference: " & objReport.Reference
  Set objReport = objGsm.GetNextReport
Wend

' Make sure to close the device to allow other applications to access it.
objGsm.Close
WScript.Echo "Done !"

Send SMS using SMPP

Send an SMS though the SMPP protocol and wait for the server to return with a reference for this message

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")             ' Create the SMPP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")    ' Create the SMS message object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf

  objSmpp.LogFile = "log.txt"                                 ' Keep a session log

  ' Connect to the remote SMPP server
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
   
  ' Create a bind on the SMPP server
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' Compose an SMS message. Make sure to assign an ID to the UserTag value to be able to 
  ' recognise this message again when it has received a message reference.
  ' Set the 'ToAddress' to "+31122334455:1000" to send to application port 1000
  objMessage.UserTag = 1
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"

  ' Send the SMS message through SMPP protocol
  objSmpp.SubmitSms objMessage
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' Wait for Sms updates to receive a message reference from the SMPP server
  While objSmpp.WaitForSmsUpdate(1000)
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
      WScript.Sleep 1
    End If
  WEnd

  WScript.Echo "Done !"

  ' Unbind and disconnect if the server does not disconnect us after unbinding
  objSmpp.Unbind
  objSmpp.Disconnect

Receive SMS using SMPP

Receive SMS messages on an SMPP connection.

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")             ' Create the SMPP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf

  objSmpp.LogFile = "log.txt"                                 ' Keep a session log

  ' Connect to the remote SMPP server
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
   
  ' Create a bind on the SMPP server
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' While bound, show all incoming messages
  WScript.Echo "Waiting for incoming messages..."
  while objSmpp.IsBound

    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      If objMessage.SmppIsDeliveryReport Then
        WScript.Echo "Delivery rpt for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
          "State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)      
      Else
        WScript.Echo "Received toaddress: " & objMessage.ToAddress
        WScript.Echo "Body: " & objMessage.Body      
      End If
      Set objMessage = objSmpp.ReceiveMessage()      
    Wend

    objSmpp.Sleep 1000
  Wend

  WScript.Echo "Done !"

  ' Unbind and disconnect if the server does not disconnect us after unbinding
  objSmpp.Unbind
  objSmpp.Disconnect

Accept incoming SMPP connections

Send and receive SMS messages to/from multiple clients simultaneously using the SmppServer object

  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")   ' Create the SMPP server object
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")  ' Create the SMS constants object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit" & objSmppServer.Version & "; Build " & _
    objSmppServer.Build & "; Module " & objSmppServer.Module
  WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf
  
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error while starting SMPP server: " & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  WScript.Echo "SMPP server started..."

  While objSmppServer.IsStarted
    Set objSmppSession = objSmppServer.GetFirstSession
    While objSmppServer.LastError = 0
      ' Accept all sessions that request a bind
      If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
        WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
        WScript.Echo "SystemId: " & objSmppSession.SystemId
        WScript.Echo "AddressRange: " & objSmppSession.AddressRange
        objSmppSession.LogFile = objSmppSession.SystemId & ".log"
        objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
      End If    
      
      If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BOUND_TRX Then
        ' Receive incoming messages
        Set objMessage = objSmppSession.ReceiveSubmitSms
        While objSmppSession.LastError = 0
          WScript.Echo "Receive sms from: " & objSmppSession.SystemId & "; to: " & _
            objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
          
          ' Accept the incoming message with the suggested message reference
          objSmppSession.RespondToSubmitSms objMessage
          If objSmppSession.LastError <> 0 Then
            WScript.Echo "Error while responding: " & _
              objSmppSession.GetErrorDescription(objSmppSession.LastError)
            WScript.Quit 1
          End If
          
          ' Send a successful delivery report for the incoming message
          objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
          objSmppSession.DeliverReport objMessage
          If objSmppSession.LastError <> 0 Then
            WScript.Echo "Error while sending delivery report: " & _
              objSmppSession.GetErrorDescription(objSmppSession.LastError)
            WScript.Quit 1
          End If
          
          Set objMessage = objSmppSession.ReceiveSubmitSms
        WEnd

        ' Deliver a new message to the client
        Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
        objMessage.ToAddress = "+31122334455"
        objMessage.FromAddress = "+35544332211"
        objMessage.Body = "Hello from the ActiveXperts Gateway !"
        objMessage.UserTag = 1 ' To identify this message when the client responds
        objSmppSession.DeliverSms objMessage
        If objSmppSession.LastError <> 0 Then
          WScript.Echo "Error while delivering: " & _
            objSmppSession.GetErrorDescription(objSmppSession.LastError)
          WScript.Quit 1
        End If
        
        ' Check if the client accepted any messages
        Set objMessage = objSmppSession.ReceiveDeliverResponse
        While objSmppSession.LastError = 0
          WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
            " for UserTag: " & objMessage.UserTag
          Set objMessage = objSmppSession.ReceiveDeliverResponse
        WEnd
      End If
      
      Set objSmppSession = objSmppServer.GetNextSession
    WEnd

    objSmppServer.Sleep 1000
  WEnd

  objSmppServer.Stop

Send SMS using HTTP

Send an SMS through the HTTP protocol object.

  Set objHttp = CreateObject("AxMmToolkit.Http")             ' Create the HTTP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")    ' Create the SMS message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objHttp.Version & "; Build " & _
    objHttp.Build & "; Module " & objHttp.Module
  WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf

  objHttp.Logfile = "log.txt"                                 ' Keep a session log

  ' Configure the HTTP protocol object for sending out SMS messages
  objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
  objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
    objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS

  ' Compose the SMS message
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short text message"

  ' Send the SMS though the HTTP protocol object
  strResponse = objHttp.SendSms(objMessage)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

  ' Echo the HTTP response
  WScript.Echo strResponse
  WScript.Echo "Done !"

Send SMS using Dialup

Send an SMS through the Dialup (UCP/TAP-XIO) protocol object.

  Set objDialup = CreateObject("AxMmToolkit.Dialup")          ' Create the Dialup protocol object
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants") ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")     ' Create the SMS message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objDialup.Version & "; Build " & _
    objDialup.Build & "; Module " & objDialup.Module
  WScript.Echo "Expiration date: " & objDialup.ExpirationDate & vbCrLf

  objDialup.LogFile = "log.txt"

  objDialup.Device = "COM2"
  objDialup.DeviceSpeed = 56000
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"                 ' Dialup provider
  
  objMessage.ToAddress = "31122334455"
  objMessage.Body = "Hello, World!"

  objDialup.Send objMessage                                   ' Send SMS message
  If objDialup.LastError <> 0 Then
    WScript.Echo "Error: " & objDialup.GetErrorDescription(objDialup.LastError)
    WScript.Quit 1
  End If

Page using SNPP

Sending a pager message through the SNPP protocol.

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")                 ' Create Snpp instance
  Set objPagerMessage = CreateObject("AxMmToolkit.PagerMessage") ' Create PagerMessage instance

  Wscript.Echo "Mobile Messaging Toolkit Version " & objSnpp.Version & "; Build " & _
    objSnpp.Build & "; Module " & objSnpp.Module
  WScript.Echo "Expiration date: " & objSnpp.ExpirationDate & vbCrLf  
  
  objPagerMessage.Recipient = "5551234"                           ' Set recipient number
  objPagerMessage.Data = "Hello, World !"                         ' Set pager message

  objSnpp.Server = "snpp.pageallcom.com"
  objSnpp.ServerPort = 444
  objSnpp.ServerTimeout = 2500                                    ' Set timeout to 2500 msecs

  objSnpp.Send(objPagerMessage)                                   ' Send the pager message

  WScript.Echo "Send, result; " & objSnpp.LastError
  WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

Send e-mail using SMTP

Send an e-mail through the SMTP protocol.

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")          ' Create the SMTP Protocol object
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")  ' Create the e-mail message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmtp.Version & "; Build " & _
    objSmtp.Build & "; Module " & objSmtp.Module
  WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf

  objSmtp.LogFile = "log.txt"                             ' Keep a session log

  ' Open a connection to the SMTP server
  objSmtp.SetSecure
  objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If

  ' Compose an e-mail message
  objMail.FromAddress = "me@gmail.com"
  objMail.FromName = "My Name"
  objMail.Subject = "Hi !"
  objMail.BodyPlainText = "Hello, How are you doing ?"
  objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
  objMail.AddTo "someone@example.com", "Someone"

  ' Send the e-mail
  objSmtp.Send objMail
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)    
  End If

  ' Disconnect from the server
  objSmtp.Disconnect
  WScript.Echo "Done !"

Receive e-mails through POP3

Receive e-mail messages through the POP3 protocol

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")          ' Create the POP3 protocol object
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")  ' Create the e-mail message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objPop3.Version & "; Build " & _
    objPop3.Build & "; Module " & objPop3.Module
  WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf

  objPop3.LogFile = "log.txt"                             ' Keep a session log

  ' Open a connection to the POP3 server
  objPop3.SetSecure
  objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If

  ' Retrieve all new messages
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  
    
    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText
    
    For j = 1 to objMail.CountAttachments()
      strName = objMail.GetAttachmentName(j)
      WScript.Echo "  Attachment found: " & strName
      ' Uncomment the following lines to save the attachments.
      'strPath = "C:\Temp\" & strName
      'WScript.Echo "  Saving attachment to : " & strPath
      'objMail.SaveAttachment j, strPath
    Next    
  Next

  objPop3.Disconnect
  WScript.Echo "Disconnected"

4.2. Visual Basic .NET

Add a reference to the Mobile Messaging Toolkit object using the Visual Basic Solution Explorer:

  • Start the Solution Explorer view, go to the project's 'References' container
  • Choose 'Add Reference' from the context menu
  • Select the COM tab, choose the 'ActiveXperts Mobile Messaging Toolkit' component

The following code shows how to declare and create the Mobile Messaging Toolkit objects:

  using AxMmCtlLib

  Smpp objSmpp;                               // Declaration
  objSmpp = new Smpp();                       // Creation
  
  Gsm objGsm;                                 // Declaration
  objGsm = new Gsm();                         // Creation

  Http objHttp;                               // Declaration
  objHttp = new Http();                       // Creation

  Snpp objSnpp;                               // Declaration
  objSnpp = new Snpp();                       // Creation

4.3. Visual C# .NET

Add a reference to the Mobile Messaging Toolkit object using the Visual C# Solution Explorer:

  • Start the Solution Explorer view, go to the project's 'References' container
  • Choose 'Add Reference' from the context menu
  • Select the COM tab, choose the 'ActiveXperts Mobile Messaging Toolkit' component

The following code shows how to declare and create the Mobile Messaging Toolkit objects:

  using AxMmCtlLib

  Smpp objSmpp;                               // Declaration
  objSmpp = new Smpp();                       // Creation
  
  Gsm objGsm;                                 // Declaration
  objGsm = new Gsm();                         // Creation

  Http objHttp;                               // Declaration
  objHttp = new Http();                       // Creation

  Snpp objSnpp;                               // Declaration
  objSnpp = new Snpp();                       // Creation

4.4. Visual Basic

The Mobile Messaging Toolkit can be used in Visual Basic 5.x or higher. In Visual Basic, go to the 'Project/References...' menu item and check the box next to Mobile Messaging Toolkit Type Library. Now, you can declare and create Mobile Messaging Toolkit objects.

The following code shows how to declare and create the Mobile Messaging Toolkit objects:

  Dim objSmpp as AxMmCtlLib.Smpp                   ' Declaration
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")   ' Creation
  
  Dim objGsm as AxMmCtlLib.Gsm                     ' Declaration
  Set objGsm = CreateObject("AxMmToolkit.Gsm")     ' Creation
  
  Dim objHttp as AxMmCtlLib.Http                   ' Declaration
  Set objHttp = CreateObject("AxMmToolkit.Http")   ' Creation

  Dim objSnpp as AxMmCtlLib.Snpp                   ' Declaration
  Set objSnpp = CreateObject("AxMmToolkit.Snpp")   ' Creation

4.5. Visual C++

The Mobile Messaging Toolkit can be used in Visual C++ projects. Include the *.h and *.c file provided by ActiveXperts to bind your code to the Mobile Messaging Toolkit component. These files are located in the Include directory of the Visual C++ samples directory. These are the files:

  • axmmctl.h
  • axmmctl.c

Declare and create new Mobile Messaging Toolkit objects like this:

  ISmpp *pSmpp;
  CoCreateInstance(CLSID_Smpp, NULL, CLSCTX_INPROC_SERVER, IID_ISmpp, (void**) &pSmpp );

  IGsm *pGsm;
  CoCreateInstance(CLSID_Gsm, NULL, CLSCTX_INPROC_SERVER, IID_IGsm, (void**) &pGsm );

  IHttp *pHttp;
  CoCreateInstance(CLSID_Http, NULL, CLSCTX_INPROC_SERVER, IID_IHttp, (void**) &pHttp );

  ISmpp *pSnpp;
  CoCreateInstance(CLSID_Snpp, NULL, CLSCTX_INPROC_SERVER, IID_ISnpp, (void**) &pSnpp );

4.6. ASP Classic

To use the Mobile Messaging Toolkit objects in ASP classic make sure the component has been installed on the server.

Declare and create the Mobile Messaging Toolkits objects like this:

  <html>
  <body>
  Version:
  <script language="vbscript" runat="server">
    Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )
    Set objGsm = CreateObject( "AxMmToolkit.Gsm" )
    Set objHttp = CreateObject( "AxMmToolkit.Http" )
    Set objSnpp = CreateObject( "AxMmToolkit.Snpp" )
    Response.Write objSmpp.Version
  </script>
  </body>
  </html>

4.7. Delphi 7.x or higher

First, add a reference to the Mobile Messaging Toolkit objects:

  • Go to Project->Import Type Library
  • Select 'ActiveXperts Mobile Messaging Toolkit Type Library'
  • Click 'Install'
  • The project 'dclusr.dpk' will be opened. Click 'Yes'
  • You can now use the Mobile Messaging Toolkit toolkit within your application by selecting the component from the 'ActiveX' component bar.
  objSmpp  : ISmpp;                                   { Declaration of the interface class  }
  objSmpp  := TSmpp.Create(Form1).DefaultInterface;   { Creation new instance of the object }

  objGsm   : IGsm;                                    { Declaration of the interface class  }
  objGsm   := TGsm.Create(Form1).DefaultInterface;    { Creation new instance of the object }
  
  objHttp  : IHttp;                                   { Declaration of the interface class  }
  objHttp  := THttp.Create(Form1).DefaultInterface;   { Creation new instance of the object }

  objSnpp  : ISnpp;                                   { Declaration of the interface class  }
  objSnpp  := TSnpp.Create(Form1).DefaultInterface;   { Creation new instance of the object }

5. API Reference

5.1. Introduction

This section presents an overview of the Mobile Messaging Toolkit API. Each section represents a component that is registered with the Mobile Messaging Toolkit ActiveX/COM .dll file. For each component all of the properties and methods are listed and explained.

5.2. Gsm

The GSM protocol object is able to connect to most GSM modem devices. Either through the TAPI (Windows Telephony API) or directly through the COM interface. The GSM protocol only uses 'AT' commands to communicate with the device and send and receive messages.

In addition to sending and receiving SMS messages it's possible to send and receive custom commands. This could be used to, for instance, send a custom initialization string to the GSM modem before usage.

Send SMS using GSM modem

This sample will send out a single SMS messaging use the first TAPI device that's connected to the PC.

  Set objGsm = CreateObject("AxMmToolkit.Gsm")             ' Create the GSM protocol object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")  ' Create the SMS message object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
    objGsm.Build & "; Module " & objGsm.Module
  WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf

  objGsm.Logfile = "log.txt"                                ' Keep a session log

  ' Open the first connected device
  sDevName = objGsm.FindFirstDevice
  objGsm.Open sDevName
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If

  ' Compose an SMS message
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "This is a short text message"

  ' Send an SMS message through the connected GSM modem device
  objGsm.SendSms objMessage
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    objGsm.Close
    WScript.Quit 1
  End If

  ' Make sure to close the device to allow other applications to access it.
  objGsm.Close
  WScript.Echo "Done !"

Receive SMS using GSM modem

Read all SMS messages and status reports that are already on the SIM and leave them on the SIM card

  Set objGsm = CreateObject("AxMmToolkit.Gsm")             ' Create the GSM protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")  ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")  ' Create the SMS message object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
    objGsm.Build & "; Module " & objGsm.Module
  WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf

  objGsm.Logfile = "log.txt"                                ' Keep a session log

  ' Open the first connected device
  sDevName = objGsm.FindFirstDevice
  objGsm.Open sDevName
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)    
    WScript.Quit 1
  End If

  ' Receive messages from the SIM card and leave them on the SIM card
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    objGsm.Close
    WScript.Quit 1
  End If

  ' Show all SMS messages
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

  ' Show all status reports
  Set objReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objReport.FromAddress & _
      "; reference: " & objReport.Reference
    Set objReport = objGsm.GetNextReport
  Wend

  ' Make sure to close the device to allow other applications to access it.
  objGsm.Close
  WScript.Echo "Done !"

Using application ports

An SMS message can specify an application port. The usage of application ports is very much like the usage of ports in the IP based protocols. If a message specifies it's application ports it will specify both a source port as well as a destination port. The source port specifies which application sent the message. The destination port specifies to which application the message was intended.

An example of the use of application ports is the WAP Push message. A WAP Push message is a binary message which will push an URL to the MT. A WAP Push message will always be sent to application port 2948 where the Push application can pick-up the message and present it to the user.

To send a message using an application port you just need to specify the port(s) in either the 'ToAddress' of the message or the 'FromAddress' or both. For example, to send a message to "+31623350000" on port number "1000" use this:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ToAddress = "31623350000:1000"

In this example the source port will be '0'. To also specify the source port use this:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ToAddress = "31623350000:1000"
  objMessage.FromAddress = ":1000"

To control the way message that are sent to a specific port are received you can use the property 'ExtractApplicationPort'

When this property is set to 'True' application port specifying UDH headers will be extracted from the SMS message and the application ports will be appended to the 'FromAddress' and the 'ToAddress' respectively. When this property is set to 'False' the application port specifying UDH headers will be ignored.

If the 'ExtractApplicationPort' property is set to true application ports will be properly extracted for 16 bit port headers as well as 8 bit port headers. When sending messages to a specific application port the 16 bit headers will always be used.

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
Manufacturer String Read The manufacturer of the open device
Model String Read The model of the open device
Revision String Read The revision number of the open device
SerialNr String Read The serial number of the open device
AssembleMultipart Boolean Read/Write Whether multipart messages should be automatically assembled
ExtractApplicationPort Boolean Read/Write Whether the application port is extracted from the message
MessageMode Number Read/Write Whether the modem should be used in Text mode or PDU mode
PreferredSmsc String Read/Write Set the preferred SMSC
SmscPrefixMode Number Read/Write Whether or not to include the SMSC prefix in PDU's
SendEnabled Boolean Read Whether the GSM modem is able to send SMS messages
ReceiveEnabled Boolean Read Whether the GSM modem is able to receive SMS messages
ReportsEnabled Boolean Read Whether the GSM modem is able to receive delivery reports
WaitForNetwork Boolean Read/Write Whether to wait for the device to register to a GSM network on open
NetworkTimeout Number Read/Write Timeout in milliseconds for registering on a GSM network
InterCommandDelay Number Read/Write Time in milliseconds between sending commands to the device
InterCharacterDelay Number Read/Write Time in milliseconds between sending characters to the device

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
FindFirstDevice Find the first connected Windows telephony device
FindNextDevice Find the next connected Windows telephony device
FindFirstPort Find the first COM port on this PC
FindNextPort Find the next COM port on this PC
Open Open a Windows telephony device or COM port
Close Close the device
SendCommand Send a custom command to the connected device
ReadResponse Read a string from the connected device
SendSms Send an SMS Message
Receive Receive SMS messages and status reports
DeleteSms Delete an SMS message
DeleteReport Delete a GsmDeliveryReport
GetFirstSms Get the first received SMS message
GetNextSms Get the next received SMS message
GetFirstReport Get the first received status report
GetNextReport Get the next received status report

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
    objGsm.Build & "; Module " & objGsm.Module
  WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
    objGsm.Build & "; Module " & objGsm.Module
  WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
    objGsm.Build & "; Module " & objGsm.Module
  WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objGsm.Version & "; Build " & _
    objGsm.Build & "; Module " & objGsm.Module
  WScript.Echo "Expiration date: " & objGsm.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objGsm.SendSms objMessage
  WScript.Echo "Send SMS result: " &  objGsm.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")   
  objGsm.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objGsm.SendSms objMessage
  ...
  

Manufacturer property

After opening a GSM device this property will return the manufacturer of the GSM device

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  sDevName = objGsm.FindFirstDevice
  WScript.Echo "Opening: " & sDevName
  objGsm.Open sDevName
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit
  End If

  WScript.Echo "Manufacturer: " & objGsm.Manufacturer
  WScript.Echo "Model: " & objGsm.Model
  WScript.Echo "Revision: " & objGsm.Revision
  WScript.Echo "SerialNr: " & objGsm.SerialNr
  ...

Model property

After opening a GSM device this property will return the model of the GSM device

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  sDevName = objGsm.FindFirstDevice
  WScript.Echo "Opening: " & sDevName
  objGsm.Open sDevName
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit
  End If

  WScript.Echo "Manufacturer: " & objGsm.Manufacturer
  WScript.Echo "Model: " & objGsm.Model
  WScript.Echo "Revision: " & objGsm.Revision
  WScript.Echo "SerialNr: " & objGsm.SerialNr
  ...

Revision property

After opening a GSM device this property will return the revision number of the GSM device

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  sDevName = objGsm.FindFirstDevice
  WScript.Echo "Opening: " & sDevName
  objGsm.Open sDevName
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit
  End If

  WScript.Echo "Manufacturer: " & objGsm.Manufacturer
  WScript.Echo "Model: " & objGsm.Model
  WScript.Echo "Revision: " & objGsm.Revision
  WScript.Echo "SerialNr: " & objGsm.SerialNr
  ...

SerialNr property

After opening a GSM device this property will return the serial number of the GSM device

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  sDevName = objGsm.FindFirstDevice
  WScript.Echo "Opening: " & sDevName
  objGsm.Open sDevName
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit
  End If

  WScript.Echo "Manufacturer: " & objGsm.Manufacturer
  WScript.Echo "Model: " & objGsm.Model
  WScript.Echo "Revision: " & objGsm.Revision
  WScript.Echo "SerialNr: " & objGsm.SerialNr
  ...

AssembleMultipart property

Set this property to true to have the Mobile Messaging Toolkit automatically assemble multipart messages on receiving them. If this property is set to false the Mobile Messaging Toolkit will return all of the individual parts on receiving a multipart message.

By default this property is set to true.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.AssembleMultipart = false
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If

  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend
  ...

ExtractApplicationPort property

This property will only affect incoming SMS messages that contain an application port specifier. An SMS can contain an application port if it is meant to target a specific application. For example a WAP Push message will always have destination port 2948 to target the WAP Push application specifically.

If this property is set to 'True' the Mobile Messaging Toolkit will interpret the application port by appending the source port to the 'FromAddress' property and the destination port to the 'ToAddress' property seperated by a colon character (':'). The Mobile Messaging Toolkit will remove the application port header from the SMS.

If this property is set to 'False' the Mobile Messaging Toolkit will not interpret the application port and leave the application port header in place. The application ports will not be added to the 'FromAddress' and 'ToAddress' properties.

By default this property is set to true.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.ExtractApplicationPort = false
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If

  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend
  ...

MessageMode property

Most modems are able to send and receive SMS messages in either Text mode or PDU mode. In PDU mode all SMS Messaging features are available, in Text mode only a subset of the features are available. Some older or specific GSM modems only support Text mode. Set this value to one of these constants.

By default this value is set to 'GSM_MESSAGEFORMAT_AUTO'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objGsm.MessageMode = objConst.GSM_MESSAGEFORMAT_TEXT
  objGsm.Open "COM1"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "I'm texting through the ActiveXperts Mobile Messaging Toolkit !"  
  objGsm.SendSms(objMessage)
  ...

PreferredSmsc property

Use this property to set the preferred SMSC address. The SMSC address should be specified as an internation numer, including '+'.

The preferred SMSC should be set before calling the Open function.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objGsm.PreferredSmsc = "+316540881000"
  objGsm.Open "COM1"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "I'm texting through the ActiveXperts Mobile Messaging Toolkit !"  
  objGsm.SendSms(objMessage)
  ...

SmscPrefixMode property

The SMS prefix mode. Some GSM modems or older mobile phones don't support prefixing SMSC information in sending and/or receiving messages. Set this value to one of these constants.

By default this value is set to 'GSM_SMSPREFIX_AUTO'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objGsm.SmscPrefixMode = objConst.GSM_SMSPREFIX_DISABLED
  objGsm.Open "COM1"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "I'm texting through the ActiveXperts Mobile Messaging Toolkit !"  
  objGsm.SendSms(objMessage)
  ...

SendEnabled property

If the GSM modem is able to send SMS messages this property will return 'True'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")   
  ...
  objGsm.Open "COM1"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If            
  ...
  WScript.Echo "Modem capabilities:"
  WScript.Echo "Receiving: " & objGsm.ReceiveEnabled
  WScript.Echo "Sending: " & objGsm.SendEnabled
  WScript.Echo "Delivery reports: " & objGsm.ReportEnabled
  ...

ReceiveEnabled property

If the GSM modem is able to receive SMS messages this property will return 'True'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")   
  ...
  objGsm.Open "COM1"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If            
  ...
  WScript.Echo "Modem capabilities:"
  WScript.Echo "Receiving: " & objGsm.ReceiveEnabled
  WScript.Echo "Sending: " & objGsm.SendEnabled
  WScript.Echo "Delivery reports: " & objGsm.ReportEnabled
  ...

ReportsEnabled property

If the GSM modem is able to receive delivery (status) reports this property will return 'True'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")   
  ...
  objGsm.Open "COM1"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If            
  ...
  WScript.Echo "Modem capabilities:"
  WScript.Echo "Receiving: " & objGsm.ReceiveEnabled
  WScript.Echo "Sending: " & objGsm.SendEnabled
  WScript.Echo "Delivery reports: " & objGsm.ReportEnabled
  ...

WaitForNetwork property

This property specifies whether or not to wait for the device to register to a GSM network on calling the Open method.

After inserting the SIM card or switching on the power supply the device may require a couple of seconds to register to the GSM network. It is generally good practice to wait for this before continuing since sending out SMS messages before the device is registered on a network may result in an error.

De default value for this property is 'true'. Use the NetworkTimeout property to set maximum amount of time to wait.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.WaitForNetwork = true
  objGsm.NetworkTimeout = 30000
  objGsm.Open "COM2", "0000"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...

NetworkTimeout property

This property specifies the maximum number of milliseconds to wait for the device to register to a GSM network on calling the Open method.

After inserting the SIM card or switching on the power supply the device may require a couple of seconds to register to the GSM network. It is generally good practice to wait for this before continuing since sending out SMS messages before the device is registered on a network may result in an error.

The default setting is 20000 milliseconds. Use the WaitForNetwork property to enable or disable waiting for registration.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.WaitForNetwork = true
  objGsm.NetworkTimeout = 30000
  objGsm.Open "COM2", "0000"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...

InterCommandDelay property

Some devices have trouble communicating at full speed and may need additional time between commands to process the commands properly. This property will support these devices by adding a set number of milliseconds of 'sleep' in between individual commands that are send to the device.

The default setting is 0 milliseconds (no delay).

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.NetworkTimeout = 30000
  objGsm.InterCommandDelay = 1000
  objGsm.InterCharacterDelay = 100  
  objGsm.Open "COM2", "0000"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...

InterCharacterDelay property

Some devices have trouble communicating at full speed and may need additional time between characters to process commands properly. This property will support these devices by adding a set number of milliseconds of 'sleep' in between individual characters that are send to the device.

The default setting is 0 milliseconds (no delay).

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.NetworkTimeout = 30000
  objGsm.InterCommandDelay = 1000
  objGsm.InterCharacterDelay = 100
  objGsm.Open "COM2", "0000"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
            
  objGsm.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ....
  objGsm.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")   
  objGsm.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objGsm.SendSms objMessage
  WScript.Echo "SendSms result: " & objGsm.LastError & ", " & _
    objGsm.GetErrorDescription(objGsm.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ....
  objGsm.Sleep 1000
  ...

FindFirstDevice function

This functions finds the first of the connected Windows telephony devices. Use this in combination with FindNextDevice to get a list of connected telephony devices.

Parameters:

  • None

Return value:

The name of the first connected Windows telephony device

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  WScript.Echo "Connected devices: "
  sDevName = objGsm.FindFirstDevice
  While objGsm.LastError = 0
    WScript.Echo sDevName
    sDevName = objGsm.FindNextDevice
  WEnd

FindNextDevice function

This function find the next of the connected Windows telephony devices. Use this in combination with FindFirstDevice to get a list of connected telephony devices.

Parameters:

  • None

Return value:

The name of the next connected Windows telephony device

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  WScript.Echo "Connected devices: "
  sDevName = objGsm.FindFirstDevice
  While objGsm.LastError = 0
    WScript.Echo sDevName
    sDevName = objGsm.FindNextDevice
  WEnd

FindFirstPort function

This functions finds the first COM port on this PC. Use this in combination with FindNextPort to get a list of COM ports on the PC.

Parameters:

  • None

Return value:

The name of the first COM port on this PC

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  WScript.Echo "Available COM ports: "
  sPortName = objGsm.FindFirstPort
  While objGsm.LastError = 0
    WScript.Echo sPortName
    sPortName = objGsm.FindNextPort
  WEnd

FindNextPort function

This function find the next COM port on this PC. Use this in combination with FindFirstPort to get a list of COM ports on the PC.

Parameters:

  • None

Return value:

The name of the next COM port on this PC

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  WScript.Echo "Available COM ports: "
  sPortName = objGsm.FindFirstPort
  While objGsm.LastError = 0
    WScript.Echo sPortName
    sPortName = objGsm.FindNextPort
  WEnd

Open function

This function opens the specified Windows telephony device or COM port. COM ports should be specified as 'COMn' where n is the number. Windows telephony devices should be specified by using the full name.

Parameters:

  • Name of the COM port of the Telephony device
  • (Optional) PIN number or an empty string
  • (Optional) Baudrate option, can be one of these constants

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Open "COM2", "0000"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...

Close function

Closes any open device handles.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Open "COM2", "0000"
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  objGsm.Close

SendCommand function

With this function you can send a custom command to the connected device.

Parameters:

  • Command to send to the device

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.SendCommand "ATI"
  sResp = objGsm.ReadResponse(1000)
  While sResp <> "OK"
    WScript.Echo "  " & sResp
    sResp = objGsm.ReadResponse(1000)
  WEnd

ReadResponse function

With this function you can read data from a connected device

Parameters:

  • (Optional) Timeout

Return value:

Data from the connected device or an empty string is no data is available

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.SendCommand "ATI"
  sResp = objGsm.ReadResponse(1000)
  While sResp <> "OK"
    WScript.Echo "  " & sResp
    sResp = objGsm.ReadResponse(1000)
  WEnd

SendSms function

This function sends an SMS message through the connected device.

Parameters:

  • The SmsMessage object
  • (Optional) Multipart flag, can be one of these constants
  • (Optional) Timeout in seconds

Return value:

The message reference(s). If it's a multipart message the references of the individual parts are comma sperated.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objGsm.SendSms objMessage
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    objGsm.Close
    WScript.Quit 1
  End If

Receive function

This function receives SMS messages and status reports from the connected device. After calling this function use GetFirstSms/GetNextSms and GetFirstReport/GetNextReport to get the SmsMessage and GsmDeliveryReport objects.

Parameters:

  • Message status, can be one of these constants
  • (Optional) Whether or not to delete messages after receiving them
  • (Optional) Which storage type to use, can be one of these constants
  • (Optional) Receive timeout

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...

DeleteSms function

Use this function to delete SMS messages. The message will be removed from the storage it was retrieved from.

Parameters:

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = objGsm.GetFirstSms
  ...
  While objGsm.LastError = 0
    If objMessage.FromAddress = "+31122334455" Then
      objGms.DeleteSms objMessage
    Else
      WScript.Echo "Received from: " & objMessage.FromAddress    
      WScript.Echo objMessage.Body
    End If
    Set objMessage = objGsm.GetNextSms
  Wend
  ...

DeleteReport function

Use this function to delete delivery reports. The delivery report will be removed from the storage it was retrieved from.

Parameters:

Return value:

Always 0.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objReport = objGsm.GetFirstReport
  ...
  While objGsm.LastError = 0
    If objReport.Reference <> "1" Then
      objGms.DeleteReport objReport
    Else
      WScript.Echo "Received reference: " & objReport.Reference    
      WScript.Echo objReport.Body
    End If
    Set objReport = objGsm.GetNextReport
  Wend
  ...

GetFirstSms function

This function gets the first SMS message that was received through the Receive function.

Parameters:

  • None

Return value:

An SMS message

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

GetNextSms function

This function gets the next SMS message that was received through the Receive function.

Parameters:

  • None

Return value:

An SMS message

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

GetFirstReport function

This function gets the first delivery report that was received through the Receive function.

Parameters:

  • None

Return value:

A GSM delivery report

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...            
  Set objReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objReport.FromAddress & _
      "; reference: " & objReport.Reference
    Set objReport = objGsm.GetNextReport
  WEnd

GetNextReport function

This function gets the next delivery report that was received through the Receive function.

Parameters:

  • None

Return value:

A GSM delivery report

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If            
  ...
  Set objReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objReport.FromAddress & _
      "; reference: " & objReport.Reference
    Set objReport = objGsm.GetNextReport
  WEnd

5.3. Smpp

The Smpp protocol object can be used to connect to remote SMSC's (SMS Centers) that support the SMPP protocol. The SMPP protocol supports sending and receive SMS messages using only an internet connection. It's primarily used for high volumes / high performance applications.

This SMPP implementation is completely asynchronous for maximum performance. To facilitate this the component keeps an internal queue of incoming and outgoing messages. This is why the component does not support a 'send message' method but rather an 'submit message' method.

Send SMS using SMPP

Send an SMS though the SMPP protocol and wait for the server to return with a reference for this message

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")             ' Create the SMPP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")    ' Create the SMS message object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf

  objSmpp.LogFile = "log.txt"                                 ' Keep a session log

  ' Connect to the remote SMPP server
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
   
  ' Create a bind on the SMPP server
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' Compose an SMS message. Make sure to assign an ID to the UserTag value to be able to 
  ' recognise this message again when it has received a message reference.
  objMessage.UserTag = 1
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"

  ' Send the SMS message through SMPP protocol
  objSmpp.SubmitSms objMessage
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' Wait for Sms updates to receive a message reference from the SMPP server
  While objSmpp.WaitForSmsUpdate(1000)
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
      WScript.Sleep 1
    End If
  WEnd

  WScript.Echo "Done !"

  ' Unbind and disconnect if the server does not disconnect us after unbinding
  objSmpp.Unbind
  objSmpp.Disconnect

Receive SMS using SMPP

Receive SMS messages on an SMPP connection.

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")             ' Create the SMPP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf

  objSmpp.LogFile = "log.txt"                                 ' Keep a session log

  ' Connect to the remote SMPP server
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
   
  ' Create a bind on the SMPP server
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' While bound, show all incoming messages
  WScript.Echo "Waiting for incoming messages..."
  while objSmpp.IsBound

    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      If objMessage.SmppIsDeliveryReport Then
        WScript.Echo "Delivery rpt for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
          "State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)      
      Else
        WScript.Echo "Received toaddress: " & objMessage.ToAddress
        WScript.Echo "Body: " & objMessage.Body      
      End If
      Set objMessage = objSmpp.ReceiveMessage()      
    Wend

    objSmpp.Sleep 1000
  Wend

  WScript.Echo "Done !"

  ' Unbind and disconnect if the server does not disconnect us after unbinding
  objSmpp.Unbind
  objSmpp.Disconnect

Using application ports

An SMS messages can specify an application port. The usage of application ports is very much like the usage of ports in the IP based protocols. If a message specifies it's application ports it will specify both a source port as well as a destination port. The source port specifies which application send the message. The destination port specifies to which application the message was intended.

An example of the use of application ports is the WAP Push message. A WAP Push message is a binary message which will push an URL to the MT. A WAP Push message will always be send to application port 2948 where the Push application can pick-up the message and present it to the user.

To send a message using an application port you just need to specify the port(s) in either the 'ToAddress' of the message or the 'FromAddress' or both. For example, to send a message to "+31623350000" on port number "1000" use this:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ToAddress = "31623350000:1000"

In this example the source port will be '0'. To also specify the source port use this:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ToAddress = "31623350000:1000"
  objMessage.FromAddress = "ActiveXprts:1000"

To control the way message that are send to a specific port are received you can use the property 'ExtractApplicationPort'

When this property is set to 'True' application port specifying UDH headers will be extracted from the SMS message and the application ports will be appended to the 'FromAddress' and the 'ToAddress' respectively. When this property is set to 'False' the application port specifying UDH headers will be ignored.

If the 'ExtractApplicationPort' property is set to true application ports will be properly extracted for 16 bit port headers as well as 8 bit port headers. When sending messages to a specific application port the 16 bit headers will always be used.

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
AssembleMultipart Boolean Read/Write Whether multipart messages should be automatically assembled
ExtractApplicationPort Boolean Read/Write Whether the application port is extracted from the message
MultipartMode Number Read/Write Specify how multipart messages should be sent
SubmitMode Number Read/Write Specify how SMS messages should be submitted to the SMSC
IsConnected Boolean Read Whether the SMPP component is connected
IsBound Boolean Read Whether the SMPP component is bound
UseGsmEncoding Boolean Read/Write User GSM encoding for text messages
MaxOutPendingPdus Number Read/Write Maximum number of outstanding PDU's
PduTimeout Number Read/Write Number of milliseconds before an outstanding PDU will timeout
EnquireInterval Number Read/Write Number of milliseconds between 'Enquire' commands
MaxSmsSubmissions Number Read/Write Maximum length of the SMS message queue
MaxSmsQueries Number Read/Write Maximum length of the SMS query queue
MaxSmsReceived Number Read/Write Maximum length of the received SMS queue

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Connect Connect to an SMPP server
Bind Bind a session after connecting to an SMPP server
Unbind Unbind a session
Disconnect Disconnect from an SMPP server
AddBindTlv Add a TLV which should be send on a 'Bind'
SubmitSms Submit an SMS message to the SMSC
WaitForSmsUpdate Wait for an update on a 'submitted' or 'queried' SMS message
FetchSmsUpdate Fetch an updated SMS message object
QuerySms Query the status of an outgoing SMS message
ReceiveMessage Receive an incoming message
CountSmsSubmissions Count the number of SMS messages in the submission queue
CountSmsQueries Count the number of SMS queries in the submission queue
CountSmsReceived Count the number of received SMS messages in the SMS queue

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )  
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objSmpp.SubmitSms objMessage
  WScript.Echo "Send SMS result: " &  objSmpp.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objSmpp = CreateObject( "AxMmToolkit.Smpp" )  
  objSmpp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objSmpp.SubmitSms objMessage
  ...
  

AssembleMultipart property

Set this property to true to have the Mobile Messaging Toolkit automatically assemble multipart messages on receiving them. If this property is set to false the Mobile Messaging Toolkit will return all of the individual parts on receiving a multipart message.

By default this property is set to true.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.AssembleMultipart = false
  While objSmpp.IsBound

    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body
      Set objMessage = objSmpp.ReceiveMessage()
    WEnd

    objSmpp.Sleep 1000
  WEnd
  ...

ExtractApplicationPort property

This property will only affect incoming SMS messages that contain an application port specifier. An SMS can contain an application port if it is meant to target a specific application. For example a WAP Push message will always have destination port 2948 to target the WAP Push application specifically.

If this property is set to 'True' the Mobile Messaging Toolkit will interpret the application port by appending the source port to the 'FromAddress' property and the destination port to the 'ToAddress' property seperated by a colon character (':'). The Mobile Messaging Toolkit will remove the application port header from the SMS.

If this property is set to 'False' the Mobile Messaging Toolkit will not interpret the application port and leave the application port header in place. The application ports will not be added to the 'FromAddress' and 'ToAddress' properties.

By default this property is set to true.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.ExtractApplicationPort = false
  While objSmpp.IsBound

    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body
      Set objMessage = objSmpp.ReceiveMessage()
    WEnd

    objSmpp.Sleep 1000
  WEnd
  ...

MultipartMode property

In combination with the Multipart flag this property specifies how multipart messages should be sent if they should be automatically formatted as multipart.

This property does not affect how multipart messages are received. Incoming multipart messages will be correctly recognised if they use 8bit or 16 bit UDH's, SAR TLV's or Payload TLV's.

By default this property is set to SMPP_MULTIPARTMODE_UDH

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.MultipartMode = objConst.SMPP_MULTIPARTMODE_SARTLV
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

SubmitMode property

This property indicates how SMS messages should be submitted to the SMSC.

If SMPP_SUBMITMODE_DATASM is selected the multipart mode will automatically be set to SMPP_MULTIPARTMODE_PAYLOADTLV.

Incoming messages, whether 'data_sm' or 'submit_sm', will always be received, regardless of this setting.

By default this property is set to SMPP_SUBMITMODE_SUBMITSM

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.SubmitMode = objConst.SMPP_SUBMITMODE_DATASM
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

IsConnected property

This property reflects whether the SMPP component is connected to the SMPP server. The property becomes false when the SMPP connection is interrupted or the Disconnect function is called.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  While objSmpp.IsConnected
    ...
    objSmpp.Sleep 1000
  WEnd  
  

IsBound property

This property reflects whether the SMPP component is bound to the SMPP server. This property becomes false when the SMPP session is unbind or disconnected or when the connection is interrupted.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  While objSmpp.IsBound
    ...
    objSmpp.Sleep 1000
  WEnd   
  

UseGsmEncoding property

Set this property to indicate whether GSM encoding should be used for incoming or outgoing text messages. Use one of these constants.

This only applies when the datacoding property is set to DATACODING_DEFAULT .

By default this is set to SMPP_USEGSMENCODING_DISABLED

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"

  objSmpp.UseGsmEncoding = objConst.SMPP_USEGSMENCODING_INANDOUT
  objSmpp.SubmitSms objMessage
  ...

MaxOutPendingPdus property

This property sets the maximum number of PDU's that can be pending for a reply from the server.

This number should be specified by the provider. If the provider does not specify this number it's safe to leave it on the default value.

Default is set to 10 PDU's

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.MaxOutPendingPdus = 100
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

PduTimeout property

Set this property to the number of milliseconds the server has to react to a given PDU before it times out. When a server fails to react to an outstanding PDU in a timely matter the connection will be closed.

Default is set to 5000 milliseconds

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.PduTimeout = 1000
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

EnquireInterval property

Set this property to the number of milliseconds between enquire commands. An enquire command is send to the server at regular intervals to keep the connection alive.

Default is set to 30000 milliseconds

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.EnquireInterval = 60000
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

MaxSmsSubmissions property

SMS Messages that are submitted to the Mobile Messaging Toolkit using the SubmitSms function are queued in the SMS message queue to be sent out at the earliest convenience though the SMPP connection.

Usually, in low volumes, the SMS message will be sent out immediately. On high volumes SMS messages may be queued if the SMSC side is unable to handle the messages as fast as they are submitted. This property sets the maximum size of the SMS submission queue.

The current size of the SMS submission queue can be found by calling CountSmsSubmissions.

Default is set to 100 SMS messages

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.MaxSmsSubmissions = 1000
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

MaxSmsQueries property

SMS queries that are submitted to the Mobile Messaging Toolkit using the QuerySms function are queued in the SMS queries queue to be sent out at the earliest convenience though the SMPP connection.

Usually, in low volumes, the SMS queries will be sent out immediately. On high volumes SMS queries may be queued if the SMSC side is unable to handle the queries as fast as they are submitted. This property sets the maximum size of the query submission queue.

The current size of the SMS submission queue can be found by calling CountSmsQueries.

Default is set to 100 SMS queries

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.MaxSmsQueries = 1000
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

MaxSmsReceived property

This is the maximum number of SMS messages that can be received by the Mobile Messaging Toolkit while connected. If this limit is exceeded the Mobile Messaging Toolkit will respond with 'SMPP_ESME_RMSGQFUL' to incoming messages.

Messages can be taken off this queue by calling 'ReceiveMessage'.

Default is set to 100 incoming SMS messages

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...
  objSmpp.LogFile = "log.txt"
  objSmpp.MaxSmsReceived = 1000
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")   
            
  Smpp.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")   
  ....
  objSmpp.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objSmpp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objSmpp.SubmitSms objMessage
  WScript.Echo "SubmitSms result: " & objSmpp.LastError & ", " & _
    objSmpp.GetErrorDescription(objSmpp.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ....
  objSmpp.Sleep 1000
  ...

Connect function

This function connects to the specified SMPP server.

Parameters:

  • Host to connect to
  • Port to connect to
  • Timeout before the connection fails

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ....
  objSmpp.LogFile = "log.txt"
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
  ...

Bind function

This function creates a 'Bind' session on the connected server. To be able to send or receive messages connection needs to be bound.

Parameters:

  • Type of bind, can be one of these constants
  • SystemId
  • Password
  • SystemType
  • Version, can be one of these constants
  • Ton, can be one of these constants
  • Npi, can be one of these constants
  • Address range
  • Timeout

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

Unbind function

Unbind a session on the server. This will cause most servers to close the connection.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If
  ...
  objSmpp.Unbind
  objSmpp.Disconnect

Disconnect function

Disconnect a from a server.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If
  ...
  objSmpp.Unbind
  objSmpp.Disconnect

AddBindTlv function

Add a TLV to the list of TLV's to be send with a session Bind

Parameters:

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objTlv = CreateObject("AxMmToolkit.Tlv")
  ...  
  objTlv.Tag = 101
  objTlv.ValueAsString = "Hello, World !"
  objSmpp.AddBindTlv objTlv
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", & _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If
  ...

SubmitSms function

Submit an SMS message. This message will be added to the internal queue of outgoing messages The messages are sent asynchronously directly after adding them to the queue. To get the status and reference ID of these message use the FetchSmsUpdate function.

Parameters:

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"

  objSmpp.SubmitSms objMessage
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If
  ...

WaitForSmsUpdate function

If a message is submitted or if a message was queried this method will return if there is an update available for this message.

Because either submitting or querying a message is always an asynchronious operation the results of this operation will never be immidiately available. This method can be used to wait until more information is available. If this method returns 'True' an updated SMS object can be retrieved using the FetchSmsUpdate function.

Parameters:

  • The maximum time to wait in milliseconds

Return value:

Wether there are SMS updates.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
      WScript.Sleep 1
    End If
  WEnd

FetchSmsUpdate function

Returns a message from the internal outgoing or query queue and remove this message from the queue. Use this function to get the status for messages that have been queued using SubmitSms or QuerySms.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.SubmitSms objMessage
  ...
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
      WScript.Sleep 1
    End If
  WEnd

QuerySms function

Query the status of an outgoing message. This is an asynchronous operation, the message will be added to the internal queue. Use the FetchSmsUpdate function to get the status of these messages.

Note: This is not the preferred method of getting SMS status information on SMPP 3.4 or higher. Use 'RequestDeliveryReport' instead.

Parameters:

Return value:

Always 0.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.QuerySms objMessage
  ...
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
      WScript.Sleep 1
    End If
  WEnd

ReceiveMessage function

Receives an incoming message. Messages are buffered internally, calling this function will return the first received message and remove it from the internal buffer.

Parameters:

  • None

Return value:

SMS Message object

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  While objSmpp.IsBound

    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body     
      Set objMessage = objSmpp.ReceiveMessage()
    WEnd

    objSmpp.Sleep 1000
  WEnd
  ...

CountSmsSubmissions function

This function returns the number of SMS messages in the submission queue. This number can be used to determine how many SMS messages submitted to the Mobile Messaging Toolkit in one batch.

Use MaxSmsSubmissions to set the maximum number of queries in the query queue.

Parameters:

  • None

Return value:

The number of messages in the SMS submission queue.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objCon = CreateObject("ADODB.Connection") 
  Set objRs = CreateObject("ADODB.Recordset")   
  ...
  While objSmpp.IsBound
    ...
    iMax = objSmpp.MaxSmsSubmissions
    iNum = objSmpp.CountSmsSubmissions()
    strQ = "SELECT TOP(" & (iMax - iNum) & ") FROM Messages"
    Set objRs = objCon.Execute(strQ)
    ...
    While Not objRs.EOF
      objMessage.ToAddress = objRs("ToAddress")
      objSmpp.SubmitSm objMessage
      ...
      objRs.MoveNext
    WEnd
    ...
    objSmpp.Sleep 1000
  WEnd
  ...

CountSmsQueries function

This function returns the number of SMS queries in the submission queue. This number can be used to determine how many SMS queries submitted to the Mobile Messaging Toolkit in one batch.

Use MaxSmsQueries to set the maximum number of queries in the query queue.

Parameters:

  • None

Return value:

The number of queries in the queries submission queue.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objCon = CreateObject("ADODB.Connection") 
  Set objRs = CreateObject("ADODB.Recordset")   
  ...
  While objSmpp.IsBound
    ...
    iMax = objSmpp.MaxSmsQueries
    iNum = objSmpp.CountSmsQueries()
    strQ = "SELECT TOP(" & (iMax - iNum) & ") FROM Messages"
    Set objRs = objCon.Execute(strQ)
    ...
    While Not objRs.EOF
      objMessage.Reference = objRs("Reference")
      objSmpp.QuerySms objMessage
      ...
      objRs.MoveNext
    WEnd
    ...
    objSmpp.Sleep 1000
  WEnd
  ...

CountSmsReceived function

This function returns the number of SMS messages in the receive queue.

Use MaxSmsReceived to set the maximum number of queries in the query queue.

Parameters:

  • None

Return value:

The number of queries in the queries submission queue.

Example:
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  While objSmpp.IsBound

    If objSmpp.CountSmsReceived() > 50 Then
      Set objMessage = objSmpp.ReceiveMessage()
      While objSmpp.LastError = 0
        WScript.Echo "Received toaddress: " & objMessage.ToAddress
        WScript.Echo "Body: " & objMessage.Body     
        Set objMessage = objSmpp.ReceiveMessage()
      WEnd
    End If

    objSmpp.Sleep 1000
  WEnd
  ...

5.4. SmppServer

The SmppServer object can be used to accept incoming SMPP connections, effectively setting up you own SMSC. The SMPP protocol supports sending and receive SMS messages using only an internet connection. It's primarily used for high volumes / high performance applications.

The SmppServer implementation is completely asynchronous for maximum performance. After starting the SmppServer a seperate thread will accept incoming connections on the specified port. For each incoming connection a dedicated worker thread will be started to handle the client connection, this is the SmppSession object. The session objects are used to excange SMS messages with connected clients.

Send and receive SMS messages from multiple clients using SmppServer

Send and receive SMS messages to/from multiple clients simultaneously using the SmppServer object

  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")   ' Create the SMPP server object
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")  ' Create the SMS constants object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit" & objSmppServer.Version & "; Build " & _
    objSmppServer.Build & "; Module " & objSmppServer.Module
  WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf
  
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error while starting SMPP server: " & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  WScript.Echo "SMPP server started..."

  While objSmppServer.IsStarted
    Set objSmppSession = objSmppServer.GetFirstSession
    While objSmppServer.LastError = 0
      ' Accept all sessions that request a bind
      If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
        WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
        WScript.Echo "SystemId: " & objSmppSession.SystemId
        WScript.Echo "AddressRange: " & objSmppSession.AddressRange
        objSmppSession.LogFile = objSmppSession.SystemId & ".log"
        objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
      End If    
      
      If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BOUND_TRX Then
        ' Receive incoming messages
        Set objMessage = objSmppSession.ReceiveSubmitSms
        While objSmppSession.LastError = 0
          WScript.Echo "Receive sms from: " & objSmppSession.SystemId & "; to: " & _
            objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
          
          ' Accept the incoming message with the suggested message reference
          objSmppSession.RespondToSubmitSms objMessage
          If objSmppSession.LastError <> 0 Then
            WScript.Echo "Error while responding: " & _
              objSmppSession.GetErrorDescription(objSmppSession.LastError)
            WScript.Quit 1
          End If
          
          ' Send a successful delivery report for the incoming message
          objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
          objSmppSession.DeliverReport objMessage
          If objSmppSession.LastError <> 0 Then
            WScript.Echo "Error while sending delivery report: " & _
              objSmppSession.GetErrorDescription(objSmppSession.LastError)
            WScript.Quit 1
          End If
          
          Set objMessage = objSmppSession.ReceiveSubmitSms
        WEnd

        ' Deliver a new message to the client
        Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
        objMessage.ToAddress = "+31122334455"
        objMessage.FromAddress = "+35544332211"
        objMessage.Body = "Hello from the ActiveXperts Gateway !"
        objMessage.UserTag = 1 ' To identify this message when the client responds
        objSmppSession.DeliverSms objMessage
        If objSmppSession.LastError <> 0 Then
          WScript.Echo "Error while delivering: " & _
            objSmppSession.GetErrorDescription(objSmppSession.LastError)
          WScript.Quit 1
        End If
        
        ' Check if the client accepted any messages
        Set objMessage = objSmppSession.ReceiveDeliverResponse
        While objSmppSession.LastError = 0
          WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
            " for UserTag: " & objMessage.UserTag
          Set objMessage = objSmppSession.ReceiveDeliverResponse
        WEnd
      End If
      
      Set objSmppSession = objSmppServer.GetNextSession
    WEnd

    objSmppServer.Sleep 1000
  WEnd

  objSmppServer.Stop

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
IsStarted Boolean Read Whether the SMPP server is started and running
LastReference Number Read/Write The last suggested message reference

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Start Starts the SMPP server
Stop Stops the SMPP server
GetFirstSession Get first connected client session
GetNextSession Get next connected client session

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmppServer.Version & "; Build " & _
    objSmppServer.Build & "; Module " & objSmppServer.Module
  WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmppServer.Version & "; Build " & _
    objSmppServer.Build & "; Module " & objSmppServer.Module
  WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmppServer.Version & "; Build " & _
    objSmppServer.Build & "; Module " & objSmppServer.Module
  WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmppServer.Version & "; Build " & _
    objSmppServer.Build & "; Module " & objSmppServer.Module
  WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error: " & objSmppServer.LastError & "," & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  ...
  objSmppServer.Stop

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error: " & objSmppServer.LastError & "," & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  ...
  objSmppServer.Stop

IsStarted property

If the SMPP server is started and running this property returns 'True'. If the server is stopped or not started yet, this property returns 'False'.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  WScript.Echo "SMPP server started: " & objSmppServer.IsStarted
  ...

LastReference property

Everytime a client submits a message to the SMPP server the SMPP server suggests message reference to return to the client. This message reference is an 8 digit hexadecimal number that is incremented for every message.

The message reference should uniquely identify an SMS message on the server.

When the message is received through the ReceiveSubmitSms function the suggested message reference is already set in the Reference property. This property can changed to suggest a different reference. The reference will be effective when calling RespondToSubmitSms.

Use this property to set a reference offset before starting or restarting the server to make sure no duplicate message references are issued. Store it regularly to keep track of the current last used message reference.

Example:

  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  objSmppServer.LastReference = lLastReference + lRestartOffset
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error: " & objSmppServer.LastError & "," & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  ...
  objSmppServer.Stop

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")
            
  objSmppServer.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")
  ....
  objSmppServer.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error: " & objSmppServer.LastError & "," & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  ...
  objSmppServer.Stop

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")
  ....
  objSmppServer.Sleep 1000
  ...

Start function

Start the SMPP server on the specified port. A dedicated thread will be started in the background which listens on the specified port for incoming connections.

For each connection an SmppSession object will be created. Use the GetFirstSession and GetNextSession functions to access these session and interact with them.

Parameters:

  • Port number

Return value:

Always 0.

Example:
  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error: " & objSmppServer.LastError & "," & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  ...
  objSmppServer.Stop

Stop function

Stop the SMPP server.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objSmppServer = CreateObject( "AxMmToolkit.SmppServer" )  
  ...
  objSmppServer.Logfile = "server.log"
  objSmppServer.Start 2775
  If objSmppServer.LastError <> 0 Then
    WScript.Echo "Error: " & objSmppServer.LastError & "," & _
      objSmppServer.GetErrorDescription(objSmppServer.LastError)
    WScript.Quit 1
  End If
  ...
  objSmppServer.Stop

GetFirstSession function

This functions returns the first connected session object. If no clients are connected nothing is returned and the LastError property is set.

Parameters:

  • None

Return value:

An SmppSession object.

Example:
  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  ...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client Ip: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId      
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If    
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd
  ...

GetNextSession function

This functions returns the next connected session object. If no clients are connected nothing is returned and the LastError property is set.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmppServer = CreateObject("AxMmToolkit.SmppServer")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  ...
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client Ip: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId      
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If    
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd
  ...

5.5. SmppSession

The SmppSession object represents a connected SMPP client. Only instances of this object that are returned from the SmppServer object can be 'Connected'. To connect to an existing SMPP client use the Smpp object.

Properties

Property Type Read/Write Description
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
LogPduDetails Boolean Read/Write Enable detailed PDU logging
Ip String Read The IP address of the remote client
Port Number Read The port number of the remote client
Version Number Read The SMPP client version of the remote client
SystemId String Read The system id of the remote client
Password String Read The password of the remote client
SystemType String Read The system type of the remote client
AddressRange String Read The address range of the remote client
AddressRangeNpi Number Read The address range NPI of the remote client
AddressRangeTon Number Read The address range TON for the remote client
ConnectionState Number Read The connection state for this session
RequestedBind Number Read The bind type this client requested

Functions

Function Description
GetErrorDescription Get the description of the given error
RespondToBind Respond to a bind request
RespondToSubmitSms Respond to an SMS submission
ReceiveSubmitSms Receive an SMS submission
RespondToQuerySms Respond to an SMS query
ReceiveQuerySms Receive an SMS Query request
DeliverSms Deliver an SMS message to the remote client
DeliverReport Deliver a delivery report to the remote client
ReceiveDeliverResponse Receive a response on an SMS delivery or delivery report
Disconnect Disconnect this session

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
    objMessage.ToAddress = "+31122334455"
    objMessage.FromAddress = "+35544332211"
    objMessage.Body = "Hello from the ActiveXperts Gateway !"
    objMessage.UserTag = 1 ' To identify this message when the client responds
    objSmppSession.DeliverSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while delivering: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

LogPduDetails property

The SMPP protocol primitives are called 'Protocol Data Units' (PDU's). Set this property to true to add a detailed description of every PDU that's send or received including a HEX dump.

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogPduDetails = True
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

Ip property

The IP address of the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

Port property

The port number of the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

Version property

The SMPP client version of the remote client. Should be on of these constants.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SMPP Version: " & objSmppSession.Version
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

SystemId property

The system id of the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

Password property

The password of the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      If objSmppSession.Password = "Secret" Then 
        objSmppSession.LogFile = objSmppSession.SystemId & ".log"
        objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
      Else
        objSmppSession.RespondToBind objConstants.SMPP_ESME_RINVPASWD
      End If
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

SystemType property

The system type of the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

AddressRange property

The address range of the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

AddressRangeNpi property

The addres range NPI (Numbering Plan Indicator) of the remote host.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      WScript.Echo "AddressRange NPI: " & objSmppSession.AddressRangeNpi
      WScript.Echo "AddressRange TON: " & objSmppSession.AddressRangeTon
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

AddressRangeTon property

The address range TON (Type of Number) for the remote client.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      WScript.Echo "AddressRange NPI: " & objSmppSession.AddressRangeNpi
      WScript.Echo "AddressRange TON: " & objSmppSession.AddressRangeTon
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

ConnectionState property

The connection state for this session. This is one of these constants.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

RequestedBind property

If the client requested a bind, this property will contain the type of bind this client requested. This is one of these constants.

The value of this property is only meaningfull when the SessionState property is set to SMPP_SESSIONSTATE_BINDING.

Example:

  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
    objMessage.ToAddress = "+31122334455"
    objMessage.FromAddress = "+35544332211"
    objMessage.Body = "Hello from the ActiveXperts Gateway !"
    objMessage.UserTag = 1 ' To identify this message when the client responds
    objSmppSession.DeliverSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while delivering: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

RespondToBind function

This function responds to an incoming bind request with the given SMPP status code. One of these constants can be used.

Use this function when the ConnectionState property is set to SMPP_SESSIONSTATE_BINDING.

If the response status is not '0' then the connection to this client will automatically be dropped and the sessions connections state set to SMPP_SESSIONSTATE_DISCONNECTED.

Parameters:

  • The status code

Return value:

Always 0

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

RespondToSubmitSms function

Respond to an SMS submission. Use ReceiveSubmitSms to receive SMS submissions and use this function to respond to the submissions with a status code.

Every received SMS message requires a response, either '0' to confirm the SMS or one of these status codes to reject an SMS.

Parameters:

  • The status code

Return value:

Always 0

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    Set objMessage = objSmppSession.ReceiveSubmitSms
    While objSmppSession.LastError = 0
      WScript.Echo "Receive sms from: " & objSmppSession.SystemId & "; to: " & _
        objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
      
      ' Accept the incoming message with the suggested message reference
      objSmppSession.RespondToSubmitSms objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while responding: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      ' Send a successful delivery report for the incoming message
      objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
      objSmppSession.DeliverReport objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while sending delivery report: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      Set objMessage = objSmppSession.ReceiveSubmitSms
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

ReceiveSubmitSms function

Receive an SMS submission from the connected client. Every SMS needs to be responded to using the RespondToSubmitSms function.

If there are no more SMS submission pending nothing will be returned and LastError will be set.

Parameters:

  • None

Return value:

An SmsMessage object

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    Set objMessage = objSmppSession.ReceiveSubmitSms
    While objSmppSession.LastError = 0
      WScript.Echo "Receive sms from: " & objSmppSession.SystemId & "; to: " & _
        objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
      
      ' Accept the incoming message with the suggested message reference
      objSmppSession.RespondToSubmitSms objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while responding: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      ' Send a successful delivery report for the incoming message
      objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
      objSmppSession.DeliverReport objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while sending delivery report: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      Set objMessage = objSmppSession.ReceiveSubmitSms
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

RespondToQuerySms function

Respond to an SMS Query request. Use ReceiveQuerySms to receive SMS queries and use this function to respond to the query with a status code.

This function requires the original SMS that way queried. Make sure the status is set to reflect the current status.

Every received SMS Query requires a response.

Parameters:

Return value:

Always 0.

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    'Don't support query_sm
    Set objMessage = objSmppSession.ReceiveQuerySms
    While objSmppSession.LastError = 0
      objMessage.SmppCommandStatus = objConstants.SMPP_ESME_RINVCMDID
      objSmppSession.RespondToQuerySms objMessage
      Set objMessage = objSmppSession.ReceiveQuerySms
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

ReceiveQuerySms function

Receive an SMS query from the connected client. The client will send an SMS message reference to query. Every SMS Query requires a response using the RespondToQuerySms function.

If there are no more SMS queries pending nothing will be returned and LastError will be set.

Parameters:

  • None

Return value:

An SmsMessage object

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    'Don't support query_sm
    Set objMessage = objSmppSession.ReceiveQuerySms
    While objSmppSession.LastError = 0
      objMessage.SmppCommandStatus = objConstants.SMPP_ESME_RINVCMDID
      objSmppSession.RespondToQuerySms objMessage
      Set objMessage = objSmppSession.ReceiveQuerySms
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

DeliverSms function

Deliver an SMS message to the remote client. For every SMS that's deliverd the client should send a response which needs to be received using the ReceiveDeliverResponse function.

Parameters:

Return value:

Always 0.

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    ' Deliver a new message to the client
    Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
    objMessage.ToAddress = "+31122334455"
    objMessage.FromAddress = "+35544332211"
    objMessage.Body = "Hello from the ActiveXperts Gateway !"
    objMessage.UserTag = 1 ' To identify this message when the client responds
    objSmppSession.DeliverSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while delivering: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    <span class="comment">' Check if the client accepted any messages</span>
    Set objMessage = objSmppSession.ReceiveDeliverResponse
    While objSmppSession.LastError = 0
      WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
        " for UserTag: " & objMessage.UserTag
      Set objMessage = objSmppSession.ReceiveDeliverResponse
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

DeliverReport function

Deliver a delivery report to the remote client. A delivery report is a special kind of SMS message that is formatted in a specific way. This function generates a delivery reports out of the original SMS that needs to be reported. Make sure that the final delivery status is set in this SMS message before passing to this function.

For every delivery report the client should send a response which needs to be received using the ReceiveDeliverResponse function.

Parameters:

  • The SmsMessage object that will be reported about

Return value:

Always 0.

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    Set objMessage = objSmppSession.ReceiveSubmitSms
    While objSmppSession.LastError = 0
      WScript.Echo "Receive sms from: " & objSmppSession.SystemId & "; to: " & _
        objMessage.ToAddress & "; suggested reference: " & objMessage.Reference                
      
      ' Accept the incoming message with the suggested message reference
      objSmppSession.RespondToSubmitSms objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while responding: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      ' Send a successful delivery report for the incoming message
      objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
      objSmppSession.DeliverReport objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while sending delivery report: " & _
          objSmppSession.GetErrorDescription(objSmppSession.LastError)
        WScript.Quit 1
      End If
      
      Set objMessage = objSmppSession.ReceiveSubmitSms
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

ReceiveDeliverResponse function

This function received the client's response on an SMS delivery or delivery report. The response will always be related to an earlier sent delivery report or sms message. The response will contain the same UserTag value that was used in orginally submitting the SMS message.

Parameters:

  • None

Return value:

The orginal SmsMessage object that was responed to.

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    ' Deliver a new message to the client
    Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
    objMessage.ToAddress = "+31122334455"
    objMessage.FromAddress = "+35544332211"
    objMessage.Body = "Hello from the ActiveXperts Gateway !"
    objMessage.UserTag = 1 ' To identify this message when the client responds
    objSmppSession.DeliverSms objMessage
    If objSmppSession.LastError <> 0 Then
      WScript.Echo "Error while delivering: " & _
        objSmppSession.GetErrorDescription(objSmppSession.LastError)
      WScript.Quit 1
    End If
    
    <span class="comment">' Check if the client accepted any messages</span>
    Set objMessage = objSmppSession.ReceiveDeliverResponse
    While objSmppSession.LastError = 0
      WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
        " for UserTag: " & objMessage.UserTag
      Set objMessage = objSmppSession.ReceiveDeliverResponse
    WEnd
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

Disconnect function

Disconnect this session. The connection on the client side will be dropped immediately.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ...
    objSmppSession.Disconnect
    ...
    Set objSmppSession = objSmppServer.GetNextSession
  WEnd

5.6. Http

A lot of bulk SMS providers or SMSC's will provide a custom, HTTP based, interface to their customers to send out SMS messages.

Providers usually employ HTTP based custom interface because of their simplicity relative to more complex protocols like SMPP. Performance wise it's roughly comparable to SMPP in medium to large volumes.

The drawback in using HTTP is that HTTP will only allow sending SMS messages. If the user needs to receive SMS messages or if the user needs to receive delivery reports the user will have to set up an HTTP server as well to receive HTTP requests from SMSC.

The Smpp object in the Mobile Messaging Toolkit is set up to support most HTTP providers. For simple provider configurations the user can set up Url and PostBody templates and use the SendSms function to send out SMS messages. For more complex configurations the Http object provides Post and Get functions to create your own URL / post body layout independent of the existing SMS message object.

Send SMS using HTTP

Send an SMS through the HTTP protocol object.

  Set objHttp = CreateObject("AxMmToolkit.Http")             ' Create the HTTP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")    ' Create the SMS message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objHttp.Version & "; Build " & _
    objHttp.Build & "; Module " & objHttp.Module
  WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf

  objHttp.Logfile = "log.txt"                                 ' Keep a session log

  ' Configure the HTTP protocol object for sending out SMS messages
  objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
  objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
    objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS

  ' Compose the SMS message
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short text message"

  ' Send the SMS though the HTTP protocol object
  strResponse = objHttp.SendSms(objMessage)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

  ' Echo the HTTP response
  WScript.Echo strResponse
  WScript.Echo "Done !"

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
WebAccount String Read/Write Web login account if required
WebPassword String Read/Write Web password if required
ProxyServer String Read/Write ProxyServer URL if required
ProxyAccount String Read/Write Proxy login account if required
ProxyPassword String Read/Write Proxy password if required
LastResponseCode Number Read Last response code returned by the server
RequestTimeout Number Read/Write Request timeout in milliseconds
Url String Read/Write Default URL, including placeholders, when sending text messages
PostBody String Read/Write Default Post body, including placeholders, when sending text messages

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
SetHeader Set HTTP header to be sent
Get Get a web page
Post Post a post body to a web server
SendSms Send a text message through this HTTP connection
UrlEncode URL encode the given string
HexEncode Hex encode the given string
Base64Encode Base64 encode the given string
Base64EncodeFile Base64 encode the given file

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objHttp = CreateObject( "AxMmToolkit.Http" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objHttp.Version & "; Build " & _
    objHttp.Build & "; Module " & objHttp.Module
  WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objHttp = CreateObject( "AxMmToolkit.Http" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objHttp.Version & "; Build " & _
    objHttp.Build & "; Module " & objHttp.Module
  WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objHttp = CreateObject( "AxMmToolkit.Http" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objHttp.Version & "; Build " & _
    objHttp.Build & "; Module " & objHttp.Module
  WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objHttp = CreateObject( "AxMmToolkit.Http" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objHttp.Version & "; Build " & _
    objHttp.Build & "; Module " & objHttp.Module
  WScript.Echo "Expiration date: " & objHttp.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objHttp = CreateObject( "AxMmToolkit.Http" )  
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objHttp.SendSms objMessage
  WScript.Echo "Send SMS result: " &  objHttp.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objHttp = CreateObject( "AxMmToolkit.Http" )   
  objHttp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objHttp.SendSms objMessage
  ...
  

WebAccount property

Set the web login account if this is required.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.WebAccount = "Account"
  objHttp.WebPassword = "Password"
  ...
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

WebPassword property

Set the web login password if this is required.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.WebAccount = "Account"
  objHttp.WebPassword = "Password"
  ...
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

ProxyServer property

Set the proxy server if this is required.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.ProxyServer = "proxy.domain.com:8080"
  objHttp.ProxyAccount = "Account"
  objHttp.ProxyPassword = "Password"
  ...
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

ProxyAccount property

Set the proxy server login if this is required.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.ProxyServer = "proxy.domain.com:8080"
  objHttp.ProxyAccount = "Account"
  objHttp.ProxyPassword = "Password"
  ...
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

ProxyPassword property

Set the proxy server password if this is required.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.ProxyServer = "proxy.domain.com:8080"
  objHttp.ProxyAccount = "Account"
  objHttp.ProxyPassword = "Password"
  ...
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

LastResponseCode property

This property is set to the last response code received from the server.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  WScript.Echo objSmpp.LastResponseCode

RequestTimeout property

This is the request timeout in milliseconds.

Default request timeout is 10000 milliseconds.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.RequestTimeout = 50000
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

Url property

This is the default URL that is being used when sending text messages trough Send Sms.

Use these placeholders to insert dynamic fields into the URL.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
  objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
    objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS 
  ...  
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

PostBody property

This is the default Post body that is being used when sending text messages trough Send Sms.

Use these placeholders to insert dynamic fields into the Post body.

Example:

  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
  objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
    objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS
  ...  
  objHttp.SendSms objMessage
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
            
  objHttp.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  ....
  objHttp.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")   
  objHttp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objHttp.SendSms objMessage
  WScript.Echo "SendSms result: " & objHttp.LastError & ", " & _
    objHttp.GetErrorDescription(objHttp.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  ....
  objHttp.Sleep 1000
  ...

SetHeader function

Set a custom HTTP header which will be include in future requests or posts made to a webserver. The header value will clear any header value of the same name that was previously set. To clear all header values call the Clear function.

Parameters:

  • Header - Name of the header
  • Value - Header value

Return value:

None

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")            
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.SetHeader("Content-Type", "application/x-www-form-urlencoded")
  ...
  strResponse = objHttp.Post("http://post.activexperts-labs.com:8080/sendsms/default.asp", _
    "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
    "&to=" & objHttp.UrlEncode(objMessage.ToAddress))
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

Get function

Get the contents of a web page from a web server and return it as a string value. This function defaults to non secure connections using the default HTTP port 80. The use of SSL or a different port can be specified as usual, e.g. https://cruisecontrol.intra:8080/dashboard connects securely on port 8080.

Parameters:

  • URL

Return value:

The requested website as a string value.

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  strResponse = objHttp.Get("http://post.activexperts-labs.com:8080/sendsms/default.asp?" & _
    "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
    "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

Post function

Post a string to a website and returns the result as a string value. This function defaults to non secure connections using the default HTTP port 80. The use of SSL or a different port can be specified as usual, e.g. https://cruisecontrol.intra:8080/dashboard connects securely on port 8080.

Parameters:

  • Url
  • Post body

Return value:

The requested website as a string value.

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  strResponse = objHttp.Post("http://post.activexperts-labs.com:8080/sendsms/default.asp", _
    "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
    "&to=" & objHttp.UrlEncode(objMessage.ToAddress))
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

SendSms function

This function sends an SMS through HTTP by replace the placeholders in the Url and PostBody parameters. If the PostBody parameter is not set it will use a 'GET' request type, otherwise a 'POST' request type will be used.

Parameters:

Return value:

The server response

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")   
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objHttp.Url = "http://post.activexperts-labs.com:8080/sendsms/default.asp"
  objHttp.PostBody = "username=CE658B84&password=FAC1982E&text=" & _
    objConst.HTTP_PLACEHOLDER_BODY & "&to=" & objConst.HTTP_PLACEHOLDER_TOADDRESS
  ...  
  WScript.Echo objHttp.SendSms(objMessage)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If

UrlEncode function

Use this function to 'URL encode' parameters before adding them to the URL or Post body.

Parameters:

  • The string to encode

Return value:

The encoded string

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  strResponse = objHttp.Get("http://post.activexperts-labs.com:8080/sendsms/default.asp?" & _
    "username=CE658B84&password=FAC1982E&text=" & objHttp.UrlEncode(objMessage.Body) & _
    "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

HexEncode function

Use this function to 'Hex' encode strings before adding them as a GET argument or POST body.

Parameters:

  • The string to encode

Return value:

The encoded string

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  strResponse = objHttp.Get("http://post.activexperts-labs.com:8080/sendsms/default.asp?" & _
    "username=CE658B84&password=FAC1982E&text=" & objHttp.HexEncode(objMessage.Body) & _
    "&to=" & objHttp.HexEncode(objMessage.ToAddress)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

Base64Encode function

Use this function to Base64 encode a string.

Parameters:

  • String to encode

Return value:

The encoded string

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  strResponse = objHttp.Get("http://post.httpprovider.com:8080/sendsms/default.asp?" & _
    "username=Name&password=Password&text=" & objHttp.Base64Encode(objMessage.Body) & _
    "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

Base64EncodeFile function

Use this function to Base64 encode a file

Parameters:

  • The filename of the file to encode

Return value:

The encoded string

Example:
  Set objHttp = CreateObject("AxMmToolkit.Http")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  strResponse = objHttp.Get("http://post.httpprovider.com:8080/sendsms/default.asp?" & _
    "username=Name&password=Password&image=" & objHttp.Base64EncodeFile("logo.png") & _
    "&to=" & objHttp.UrlEncode(objMessage.ToAddress)
  If objHttp.LastError <> 0 Then
    WScript.Echo "Error: " & objHttp.GetErrorDescription(objHttp.LastError)
    WScript.Quit 1
  End If
  
  WScript.Echo strResponse
  ...

5.7. Dialup

The Dialup object enables you to send SMS messages using a normal Hayes compatible modem (1200 bps or higher). The modem connects to an SMSC dial-in service provider to deliver the SMS message.

You can use the Dialup object to send SMS messages; receiving messages is not supported by the nature of SMSC Service Providers. The Dialup object can only send messages one-by-one.

There are many SMSC dial-in service providers around the world; click here for a list of supported SMS providers.

The Dialup object communicates with a normal modem using either a direct COM port, or using a Windows telephony device. It is recommended to use Windows telephony devices, for instance 'Standard 9600 bps Modem'.

If a Windows telephony device is used, settings are controlled by the Windows telephony driver, and can be configured through the 'Phone and Modem' settings:

  1. Open the Windows Control Panel from the Start menu;
  2. Double-click on 'Phone and Modem Options' and select the 'Modems' tab;
  3. Select the preferred modem and click on 'Properties'; from here, you can change the settings.

You can only send plain text messages. To send advanced SMS messages (like: flash, multi-part messages, data, ringtones, unicode, etc.) try the Gsm or Smpp object.

There are two types of SMSC dial-in providers:

  • TAP/XIO providers;
  • UCP providers.

The Dialup object supports them both. Our list of supported SMSC providers shows the type of provider (TAP/XIO or UCP) for each provider.

Send SMS using Dialup

Send an SMS through the Dialup (UCP/TAP-XIO) protocol object.

  Set objDialup = CreateObject("AxMmToolkit.Dialup")          ' Create the Dialup protocol object
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants") ' Create the global constants object
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")     ' Create the SMS message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objDialup.Version & "; Build " & _
    objDialup.Build & "; Module " & objDialup.Module
  WScript.Echo "Expiration date: " & objDialup.ExpirationDate & vbCrLf

  objDialup.LogFile = "log.txt"

  objDialup.Device = "COM2"
  objDialup.DeviceSpeed = 56000
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"                 ' Dialup provider
  
  objMessage.ToAddress = "31122334455"
  objMessage.Body = "Hello, World!"

  objDialup.Send objMessage                                   ' Send SMS message
  If objDialup.LastError <> 0 Then
    WScript.Echo "Error: " & objDialup.GetErrorDescription(objDialup.LastError)
    WScript.Quit 1
  End If

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
Device String Read/Write Name of the device you want to use for sending the SMS messages
DeviceSpeed Number Read/Write The baudrate of the communication session
DeviceSettings Number Read/Write Identifier indicating databits, parity and stopbits
DeviceInitString String Read/Write Initialization string for the device
Dialmode Number Read/Write Tone or Pulse. Default: Tone
ProviderDialString String Read/Write Dial-string to dial-up to the provider
ProviderPassword String Read/Write Optional password to log on to the provider (UCP only)
ProviderType Number Read/Write Type of provider; can be UCP or TAP
ProviderResponse String Read Last response from provider

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
GetDeviceCount Return the number of Windows telephony devices installed on the local computer
GetDevice Retrieve a Windows telephony device name
Send Deliver the message to the SMSC provider. The SMSC provider will send the SMS message to the recipient
ProviderLoadConfig Load SMSC specific parameters from a configuration file
ProviderSaveConfig Save SMSC specific parameters to a configuration file

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objDialup.Version & "; Build " & _
    objDialup.Build & "; Module " & objDialup.Module
  WScript.Echo "Expiration date: " & objDialup.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objDialup.Version & "; Build " & _
    objDialup.Build & "; Module " & objDialup.Module
  WScript.Echo "Expiration date: " & objDialup.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objDialup.Version & "; Build " & _
    objDialup.Build & "; Module " & objDialup.Module
  WScript.Echo "Expiration date: " & objDialup.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objDialup.Version & "; Build " & _
    objDialup.Build & "; Module " & objDialup.Module
  WScript.Echo "Expiration date: " & objDialup.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  ...
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..
  objDialup.Send objMessage
  WScript.Echo "Send result: " &  objDialup.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

Device property

The preferred device for sending SMS messages. You can either use a Windows telephony device (recommended) or a physical COM port (directly).

Assign one of the following strings to the 'Device' property:

  • A valid Windows telephony device name - this must be the exact name as it appears in Modems tab of the Phone and Modems Options applet in the Control Panel. For instance: "Standard 9600 bps Modem";
  • Use the GetDevice function to retrieve Windows telephony device names;
  • A valid COM port string, formatted as COMx, where x is a valid COM port number. When you assign the 'Device' property with a COM port string, you bypass all Windows telephony intelligence, like dialing rules, port sharing and so on.

Windows telephony devices are highly recommended.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.Device = "COM1"
  objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

DeviceSpeed property

By default, the speed settings are inherited from the Windows telephony device, or (in case a direct COM port is used) the default COM settings are used.

Use one of these values.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")            
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

DeviceSettings property

By default, the databits/parity/stopbits settings are inherited from the Windows telephony device, or (in case a direct COM port is used) the default COM settings are used (8 databits, no parity, 1 stopbit).

Use one of these values.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")            
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
  objDialup.DeviceSettings = objConstants.DIALUP_DEVICESETTINGS_8N1
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

DeviceInitString property

Initialization string for the modem. Following string is used to initialize a modem:

  • If a Windows telephony device is used, the Windows telephony initialization string is used (the 'DeviceInitString' property is ignored);
  • If a direct COM port is used, the 'DeviceInitString' property is used to initialize the device.

As said, the 'DeviceInitString' property is ignored if a Windows telephony device is used. If you are using a direct port device, and you assign a string to the 'DeviceInitString' property, the string will be used to initialize the modem.

Important: commands can be separated by the ';' character, and will issued separately. So, if 'DeviceInitString' property holds the "ATZ" string, the toolkit first issues ATZ, waits for the OK response, then issues the AT&C1&K0 command and again waits for the OK response.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")            
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
  objDialup.DeviceInitString = "AT&F;AT&C1&K0"
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

Dialmode property

Set the 'DialMode' property to specify 'Tone' or 'Pulse' dialing. Click here for the values.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")            
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.Dialmode = objConstants.DIALUP_DIALMODE_TONE
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

ProviderDialString property

Dial string to dial-up to the provider.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

ProviderPassword property

Password used to logon to the provider. The majority of the TAP/UCP providers do not require a password; however, if a password is required, you can set it here.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.DeviceSpeed = objConstants.GSM_BAUDRATE_56000
  objDialup.ProviderPassword = "Passw0rd"
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

ProviderType property

Type of provider; click here for a list of values.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")            
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  ...

ProviderResponse property

ProviderResponse holds the last response from the Dial-Up provider. Use it for troubleshooting.

Example:

  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")            
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  ...
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ..  
  objDialup.Send objMessage
  WScript.Echo objDialup.ProviderResponse
  ...

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
            
  objDialup.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  ....
  objDialup.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")   
  objDialup.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objDialup.Send objMessage
  WScript.Echo "SendSms result: " & objDialup.LastError & ", " & _
    objDialup.GetErrorDescription(objDialup.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  ....
  objDialup.Sleep 1000
  ...

GetDeviceCount function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  ....
  n = objDialupProtocol.GetDeviceCount()
  For i = 0 to n-1
     WScript.Echo "Device " & i & ": " & objDialupProtocol.GetDevice( i )
  Next
  ...

GetDevice function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  ....
  n = objDialupProtocol.GetDeviceCount()
  For i = 0 to n-1
     WScript.Echo "Device " & i & ": " & objDialupProtocol.GetDevice( i )
  Next
  ...

Send function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")  
  ...
  objMessage.ToAddress = "31623350218"
  objMessage.Body = "Hello world!"
  ...
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ...
  objDialup.Send objMessage

ProviderLoadConfig function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")  
  ...
  objDialup.ProviderLoadConfig "D:\ActiveXperts\Mobile Messaging Toolkit\MyProvider.dial"

ProviderSaveConfig function

Save provider specific information to a SmsProtocolDialup configuration file.

Parameters:

  • A SmsProtocolDialup file. A previous SmsProtocolDialup file will be overwritten automatically.

Return value:

Always 0.

Example:
  Set objDialup = CreateObject("AxMmToolkit.Dialup")
  Set objConstants = CreateObject("AxMmToolkit.SmsConstants")  
  ...  
  objDialup.Dialmode = objConstants.DIALUP_DIALMODE_TONE
  objDialup.ProviderPassword = "Passw0rd"
  objDialup.ProviderType = objConstants.DIALUP_PROVIDERTYPE_UCP
  objDialup.ProviderDialString = "0653141410"
  ...
  objDialup.ProviderSaveConfig "D:\ActiveXperts\Mobile Messaging Toolkit\MyProvider.dial"

5.8. SmsMessage

Properties

Property Type Read/Write Description
LastError Number Read Result of the last called method
UserTag Number Read/Write User defined value to track this object
ToAddress String Read/Write The address to send this message to
FromAddress String Read/Write The address this message was received from
Body String Read/Write The body value of the SMS message
RequestDeliveryReport Boolean Read/Write Whether or not to request a delivery report
ToAddressTON String Read/Write Type of Number for the 'ToAddress'
ToAddressNPI String Read/Write Number Plan Indicator for the 'ToAddress'
FromAddressTON String Read/Write Type of Number for the 'FromAddress'
FromAddressNPI String Read/Write Number Plan Indicator for the 'FromAddress'
ProtocolId String Read/Write The protocol ID
ValidityPeriod Number Read/Write Validity Period in minutes
Reference String Read/Write Message reference
DataCoding Number Read/Write Data coding
BodyFormat Number Read/Write Body format
HasUdh Boolean Read/Write Whether a User Data Header is present
ReceiveTime String Read Receive time
ReceiveTimeInSeconds Number Read Receive time in seconds
TotalParts Number Read The total number of message parts
PartNumber Number Read The part number for this message
GsmFirstOctet Number Read/Write GSM specific, First octet
GsmSmscAddress String Read GSM specific, SMSC address
GsmSmscAddressTON Number Read GSM specific, Address TON
GsmSmscAddressNPI Number Read GSM specific, Address NPI
GsmMemoryIndex String Read GSM specific, Memory index
GsmMemoryLocation String Read GSM specific, Memory location
SmppPriority Number Read/Write SMPP specific, priority
SmppServiceType String Read/Write SMPP specific, service type
SmppEsmClass Number Read/Write SMPP specific, ESM class
SmppStatus Number Read SMPP specific, message status
SmppError Number Read SMPP specific, message error code
SmppIsDeliveryReport Number Read SMPP specific, whether this SMS message is a delivery report
SmppCommandStatus Number Read/Write SMPP specific, command status

Functions

Function Description
Clear Reset all properties to their default values
SmppAddTlv Reset all properties to their default values
SmppGetTlv Get a specific TLV value from this message
SmppGetFirstTlv Get the first TLV value attached to this message
SmppGetNextTlv Get the next TLV value attached to this message

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  Set objTlv = objSmsMessage.SmppGetFirstTlv()
  While objMessage.LastError = 0
    WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
    Set objTlv = objMessage.SmppGetNextTlv()
  Wend
  ...

UserTag property

This can be any value. Use this property to track an SMS message.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.UserTag = 1
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

ToAddress property

This property contains the address to send the SMS Message to.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.UserTag = 1
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

FromAddress property

This property contains the address this message was received from.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.FromAddress = "ActvXprts"
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

Body property

The body value of the SMS message. When setting or getting this property the format is determined by the BodyFormat property.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.FromAddress = "ActvXprts"
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

RequestDeliveryReport property

Use this property to request a delivery report when this message is sent. Setting this property to true has the same effect as setting SmppEsmClass to SMPP_ESM_2ESME_DELIVERY_RECEIPT when sending through SMPP or settings GsmFirstOctet to GSM_FO_STATUS_REPORT when sending through GSM.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.RequestDeliveryReport = true
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

ToAddressTON property

This is the type of number for the ToAddress property. Set this to one of these constants.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.ToAddressTON = objConst.TON_INTERNATIONAL
  objMessage.ToAddressNPI = objConst.NPI_ISDN
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

ToAddressNPI property

This is the number plan indicator for the ToAddress property. Set this to one of these constants.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.ToAddressNPI = objConst.NPI_ISDN
  objMessage.ToAddressTON = objConst.TON_INTERNATIONAL
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

FromAddressTON property

This is the type of number for the FromAddress property. Set this to one of these constants.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.FromAddressNPI = objConst.NPI_ISDN
  objMessage.FromAddressTON = objConst.TON_ALPHANUMERIC
  objMessage.FromAddress = "ActvXprts"
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

FromAddressNPI property

This is the number plan indicator for the FromAddress property. Set this to one of these constants.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.FromAddressNPI = objConst.NPI_ISDN
  objMessage.FromAddressTON = objConst.TON_ALPHANUMERIC
  objMessage.FromAddress = "ActvXprts"
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

ProtocolId property

This is the protocol ID that's going to be sent with this SMS message.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ProtocolId = ""
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

ValidityPeriod property

This is the validity period for the SMS message in minutes. The validity period is the time the SMSC will try to deliver this message. If the SMSC is unable to deliver the message within its validity period the message is failed.

The default value is '0' which uses the SMSC default validity period.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.ValidityPeriod = 300
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

Reference property

This is the message reference. When using SMPP this is the reference obtained from SMSC, when using GSM this will be the reference obtained from the GSM modem.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag
      WScript.Sleep 1
    End If
  WEnd

DataCoding property

Data coding byte. This property should be used to set the required datacoding of the property field, for instance, when a message should be sent as Unicode instead of the normal 7 bit GSM character set.

When setting this property use these constants.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.DataCoding = objConst.DATACODING_UNICODE
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

BodyFormat property

The body format property. This specifies the format of the Body property. When setting this property use these constants

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.BodyFormat = objConst.BODYFORMAT_TEXT
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

HasUdh property

Whether a User Data Header is present. This specifies if the SMS message has a UDH header prefixing the message.

Since a UDH header is always binary the BodyFormat will always be set to BODYFORMAT_HEX on incoming messages that have a UDH header. When sending a message with a UDH header the message should be specified in HEX.

Depending on the multipart or application port settings on either the GSM or the SMPP protocol the Mobile Messaging Toolkit may generate UDH headers when sending and splitting up multipart messages or application port messages. In the same way the Mobile Messaging Toolkit may intepret UDH headers when receiving multipart or application port headers. In these cases the hasUdh property will remain 'false' unless a UDH header cannot be intepreted or does not need to be generated and ends up in the SmsMessage object.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.BodyFormat = objConst.BODYFORMAT_TEXT
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

ReceiveTime property

This property will contain the receive time of this message.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Receive time: " & objMessage.ReceiveTime
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

ReceiveTimeInSeconds property

This property will contain the receive time of this message in seconds.

The receive time is in seconds since 1/1/1970 (Unix time-stamp) format.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Receive time in seconds: " & objMessage.ReceiveTimeInSeconds
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

TotalParts property

If this message is part of a multipart message this property will be set to the total number of parts the multipart message consists of. The 'PartNumber' property contains the part number for this message.

This property will be set in the following cases:

  • This message was send through SMPP and split up into multiple messages
  • This is a multipart message received through SMPP with the AssembleMultipart property set to 'false'
  • This is a multipart message received through GSM with the AssembleMultipart property set to 'false'

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objGsm.AssembleMultipart = false
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    WScript.Echo "Part " & objMessage.PartNumber & " from " & objMessage.TotalParts    
    Set objMessage = objGsm.GetNextSms
  Wend

PartNumber property

If this message is part of a multipart message this property will be set to the part number of this SMS message. The 'TotalParts' property contains the total number of parts for the entire message

This property will be set in the following cases:

  • This message was send through SMPP and split up into multiple messages
  • This is a multipart message received through SMPP with the AssembleMultipart property set to 'false'
  • This is a multipart message received through GSM with the AssembleMultipart property set to 'false'

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objGsm.AssembleMultipart = false
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_UNREAD
  If objGsm.LastError <> 0 Then
    WScript.Echo "Error: " & objGsm.GetErrorDescription(objGsm.LastError)
    WScript.Quit 1
  End If
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo objMessage.Body
    WScript.Echo "Part " & objMessage.PartNumber & " from " & objMessage.TotalParts    
    Set objMessage = objGsm.GetNextSms
  Wend

GsmFirstOctet property

This is the first octet value. This property is used when a specific first octet setting is required which can not be set using other properties like RequestDeliveryReport

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.GsmFirstOctet = objConst.GSM_FO_UDHI
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

GsmSmscAddress property

The address for the SMSC that delivered this SMS. To specify a preferred SMS to delivery a message use the PreferredSmsc property on the Gsm object.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Smsc address: " & objMessage.GsmSmscAddress
    WScript.Echo "Smsc address TON: " & objMessage.GsmSmscAddressTON
    WScript.Echo "Smsc address NPI: " & objMessage.GsmSmscAddressNPI
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

GsmSmscAddressTON property

The Type of Number for the SmscAddress. This will always be one of these constants.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Smsc address: " & objMessage.GsmSmscAddress
    WScript.Echo "Smsc address TON: " & objMessage.GsmSmscAddressTON
    WScript.Echo "Smsc address NPI: " & objMessage.GsmSmscAddressNPI
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

GsmSmscAddressNPI property

The Numbering Plan Indicator for the SmscAddress. This will always be one of these constants.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Smsc address: " & objMessage.GsmSmscAddress
    WScript.Echo "Smsc address TON: " & objMessage.GsmSmscAddressTON
    WScript.Echo "Smsc address NPI: " & objMessage.GsmSmscAddressNPI
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

GsmMemoryIndex property

If this message was received through GSM this property will contain the memory index that holds this message. Together with the MemoryLocation this property identifies where this message is located in the device.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Memory index: " & objMessage.GsmMemoryIndex
    WScript.Echo "Memory location: " & objMessage.GsmMemoryLocation
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

GsmMemoryLocation property

If this message was received through GSM this property will contain the memory location that holds this message. Together with the MemoryIndex this property identifies where this message is located in the device.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")  
  ...
  Set objMessage = objGsm.GetFirstSms
  While objGsm.LastError = 0
    WScript.Echo "Received from: " & objMessage.FromAddress
    WScript.Echo "Memory index: " & objMessage.GsmMemoryIndex
    WScript.Echo "Memory location: " & objMessage.GsmMemoryLocation
    WScript.Echo objMessage.Body
    Set objMessage = objGsm.GetNextSms
  Wend

SmppPriority property

Set this property to the message priority. Use one of these constants

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.SmppPriority = objConst.GSM_FO_UDHI
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

SmppServiceType property

Set this property to the service type. These are some service types that can be used:

  • "" - Empty string (default)
  • "CMT" - Cellular Messaging
  • "CPT" - Cellular Paging
  • "VMN" - Voice Mail Notification
  • "VMA" - Voice Mail Alerting
  • "WAP" - Wireless Application Protocol
  • "USSD" - Unstructured Supplementary Services Data
  • "CBS" - Cell Broadcast Service
  • "GUTS" - Generic UDP Transport Service

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.SmppServiceType = "USSD"
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "?*101#??"
  ...

SmppEsmClass property

This is the ESM class value. This property is used when a specific ESM class setting is required which can not be set using other properties like . Use one of these constants.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objMessage.SmppEsmClass = objConst.SMPP_ESM_2ESME_DELIVERY_RECEIPT
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

SmppStatus property

This is the last known message status for an SMPP message. This property is always set to one of these constants.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.QuerySms objMessage
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag & _
        objMessage.SmppStatus
      WScript.Sleep 1
    End If
  WEnd

SmppError property

This is the error code for this message. This will only be set by querying a message.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.QuerySms objMessage
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag & _
        objMessage.SmppError
      WScript.Sleep 1
    End If
  WEnd

SmppIsDeliveryReport property

This property will be set to true if this message is a delivery report.

Using this property is equivalent to testing the 'SmppEsmClass' property for the 'SMPP_ESM_2ESME_DELIVERY_RECEIPT' bit.

Example:

  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  ...  
  Set objMessage = objSmpp.ReceiveMessage()
  While objSmpp.LastError = 0
    If objMessage.SmppIsDeliveryReport Then
      WScript.Echo "Delivery rpt for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
        "State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)      
    Else
      WScript.Echo "Received toaddress: " & objMessage.ToAddress
      WScript.Echo "Body: " & objMessage.Body      
    End If
    Set objMessage = objSmpp.ReceiveMessage()
  Wend  
  ...

SmppCommandStatus property

This is the command status from the 'SUBMIT_SM_RESP' command or the 'QUERY_SM_RESP' command if applicable. If an SMS message is rejected by the server this will contain a status code. This will always be set to one of these constants.

Example:

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objSmpp.SubmitSms objMessage
  While objSmpp.WaitForSmsUpdate
    Set objMessage = objsmpp.FetchSmsUpdate
    If objSmpp.LastError = 0 And objMessage.SmppCommandStatus = 0 Then
      WScript.Echo "Reference: " & objMessage.Reference & "; UserTag: " & objMessage.UserTag &
    ElsIf objMessage.SmppCommandStatus <> 0 Then
      WScript.Echo "Status: " & objMessage.SmppCommandStatus
    End
    WScript.Sleep 1
  WEnd

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  ...
  objMessage.Clear  
  objMessage.ToAddress = "+31122334455"
  objMessage.Body = "Short SMS message"
  ...

SmppAddTlv function

Add a Tlv (Tag, Length, Value) object to this message.

Parameters:

Return value:

None

Example:
  Set objSmsMessage = CreateObject( "AxMmToolkit.SmsMessage" )
  Set objTlv = CreateObject("AxMmToolkit.Tlv")  
  ...
  objTlv.Tag = 100
  objTlv.ValueAsString = "Hello"
  objSmsMessage.SmppAddTlv objTlv
  ...

SmppGetTlv function

This function returns a specific TLV (Tag, Length, Value) object according to the Tag value. This is a list of common TLV Tag values.

Parameters:

  • The Tag value

Return value:

Tlv object

Example:
  Set objSmsMessage = CreateObject( "AxMmToolkit.SmsMessage" )
  ...
  Set objTlv = objSmsMessage.SmppGetTlv(100)
  WScript.Echo objTlv.ValueAsHexString  
  ...

SmppGetFirstTlv function

This function return the first TLV value attached to this message.

Parameters:

  • None

Return value:

Tlv object

Example:
  Set objSmsMessage = CreateObject( "AxMmToolkit.SmsMessage" )
  ...
  Set objTlv = objSmsMessage.SmppGetFirstTlv()
  While objSmsMessage.LastError = 0
    WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
    Set objTlv = objSmsMessage.SmppGetNextTlv()
  Wend

SmppGetNextTlv function

This function return the first TLV value attached to this message

Parameters:

  • None

Return value:

Tlv object

Example:
  Set objSmsMessage = CreateObject( "AxMmToolkit.SmsMessage" )
  ...
  Set objTlv = objSmsMessage.SmppGetFirstTlv()
  While objSmsMessage.LastError = 0
    WScript.Echo "Tag: " & objTlv.Tag & "; Value: " & objTlv.ValueAsHexString
    Set objTlv = objSmsMessage.SmppGetNextTlv()
  WEnd

5.9. SmsDataWapPush

The SmsData... objects are used to generate SMS messages whith special functions. You can set the properties according to your needs and call the Encode function to generate a message body. Set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

A WAPPush message can be used to push an URL to a mobile phone. The phone will show the URL along with a description and the option to visit this URL.

Note: Most modern smart phones, like the iPhone and recent Android based phones, no longer support this message type.

Properties

Property Type Read/Write Description
Url String Read/Write The URL to send
Description String Read/Write The description to send
SignalAction Number Read/Write The type of WAPPush action
Data String Read/Write The actual WAPPush message
LastError String Read Result of the last called method

Functions

Function Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Encode Creates the actual WAPPush message out of the property settings

Url property

This is the URL to send to the mobile device.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.Signal = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX
  
  objGsm.SendSms objMessage
  ...

Description property

This is the description to go with the URL

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX
  
  objGsm.SendSms objMessage
  ...

SignalAction property

This is the signal action that should be used. It is either the priority of the WAPPush message or sets it to delete.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX
  
  objGsm.SendSms objMessage
  ...

Data property

After calling the Encode function this property will contain the WAPPush body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX
  
  objGsm.SendSms objMessage
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode
  If objWapPush.LastError <> 0 Then
    WScript.Echo objWapPush.GetErrorDescription(objWapPush.LastError)
    WScript.Quit
  End If
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  ...
  objWapPush.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode
  If objWapPush.LastError <> 0 Then
    WScript.Echo objWapPush.GetErrorDescription(objWapPush.LastError)
    WScript.Quit
  End If
  ...

Encode function

Creates WAPPush message according to the current settings. After calling this function the Data property will contain the WAPPush body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Parameters:

  • None

Return value:

Always returns 0

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objWapPush = CreateObject("AxMmToolkit.SmsDataWapPush")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
  ...
  objWapPush.Description = "Innovators in Communication"
  objWapPush.Url = "www.ActiveXperts.com"
  objWapPush.SignalAction = objConst.WAPPUSH_SIGNAL_MEDIUM
  objWapPush.Encode

  objMessage.ToAddress = "+31122334455"
  objMessage.Body = objWapPush.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX
  
  objGsm.SendSms objMessage
  ...

5.10. SmsDatavCard

The SmsData.. objects are used to generate SMS messages whith special functions. You can set the properties according to your needs and call the Encode function to generate a message body. Set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

A vCard message can be used to push a virtual business card to a mobile phone.

Note: Most modern smart phones, like the iPhone and recent Android based phones, no longer support this message type.

Properties

Property Type Read/Write Description
Url String Read/Write URL pointing to the website of the contact
Title String Read/Write The title of the contact
EMail String Read/Write E-mail address
Fax String Read/Write Fax number
Pager String Read/Write Pager number
Mobile String Read/Write Mobile number
PhoneHome String Read/Write Home phone number
Phone String Read/Write Phone number
Name String Read/Write Name
Data String Read/Write The actual vCard message
LastError String Read Result of the last called method

Functions

Function Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Encode Creates the actual vCard message out of the property settings

Url property

This is the URL pointing to the website of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Phone = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Title property

This is the title of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Phone = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

EMail property

This is the e-mail address of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Phone = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Fax property

This is the fax number of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Fax = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Pager property

This is the pager number of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Pager = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Mobile property

This is the mobile number of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Mobile = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

PhoneHome property

This is the home phone number of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.PhoneHome = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Phone property

This is a general phone number of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.PhoneWork = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Name property

The name of the contact

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

Data property

After calling the Encode function this property will contain the WAPPush body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode

  objMessage.Body = objvCard.Data
  objMessage.HasUdh = true
  objMessage.BodyFormat = objConst.BODYFORMAT_HEX

  strRef = objGsm.SendSms(objMessage)  
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Phone = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode
  If objvCard.LastError <> 0 Then
    WScript.Echo objvCard.GetErrorDescription(objvCard.LastError)
  End If  
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  ...
  objvCard.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Phone = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode
  If objvCard.LastError <> 0 Then
    WScript.Echo objvCard.GetErrorDescription(objvCard.LastError)
  End If  
  ...

Encode function

Creates vCard message according to the current settings. After calling this function the Data property will contain the vCard body as a HEX encoded string. To send this message set this body into an SMS and set the HasUdh property to true and the BodyFormat property to 'BODYFORMAT_HEX'.

Parameters:

  • None

Return value:

Always returns 0

Example:
  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  Set objvCard = CreateObject("AxMmToolkit.SmsDatavCard")
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")
            
  objvCard.Url = "http://www.ActiveXperts.com"
  objvCard.Title = "Customer support"
  objvCard.EMail = "support(at)activexperts.com"
  objvCard.Phone = "+31122334455"
  objvCard.Name = "Customer Support ActiveXperts"
  objvCard.Encode
  If objvCard.LastError <> 0 Then
    WScript.Echo objvCard.GetErrorDescription(objvCard.LastError)
  End If  
  ...

5.11. GsmDeliveryReport

Properties

Property Type Read/Write Description
Reference String Read The message reference
UserTag Number Read/Write User defined value to track this object
SmscAddress Number Read SMSC address
SmscTime String Read SMSC Time
SmscTimeInSeconds Number Read SMSC time in seconds
DischargeTime String Read Discharge time
DischargeTimeInSeconds Number Read Discharge time in seconds
MemoryIndex String Read The memory index for this delivery report
FirstOctet Number Read First octet
SmscTON Number Read The type of number of the SMSC address
SmscNPI Number Read The number plan indicator for the SMSC address.
Status Number Read The message delivery status
FromAddress String Read The address the original SMS message was send to

Functions

Function Description
Clear Reset all properties to their default values

Reference property

The message reference for the delivery report. This should match with the message reference received when sending the SMS message out through the GSM object.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.Reference
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.SmscTime
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

UserTag property

This can be any value. Use this property to track a delivery report.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.Reference
    WScript.Echo objGsmDeliveryReport.UserTag
    WScript.Echo objGsmDeliveryReport.SmscTime
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

SmscAddress property

The address of the SMS that originated this report

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.Reference
    WScript.Echo objGsmDeliveryReport.UserTag
    WScript.Echo objGsmDeliveryReport.SmscAddress
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

SmscTime property

The time the original SMS message was received

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.Reference
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.SmscTime
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

SmscTimeInSeconds property

The time the original SMS message was received in seconds since 1/1/1970

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.SmscTime
    WScript.Echo objGsmDeliveryReport.SmscTimeInSeconds
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

DischargeTime property

The time the status in this report was achieved.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.SmscTime
    WScript.Echo objGsmDeliveryReport.DischargeTime
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

DischargeTimeInSeconds property

The time the status in this report was achieved in seconds since 1/1/1970

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.DischargeTime
    WScript.Echo objGsmDeliveryReport.DischargeTimeInSeconds
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

MemoryIndex property

This property holds the memory index in the modems memory for this delivery report

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.FromAddress
    WScript.Echo objGsmDeliveryReport.MemoryIndex
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

FirstOctet property

This property holds the first octet value for this delivery report

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.FromAddress
    WScript.Echo objGsmDeliveryReport.FirstOctet
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

SmscTON property

This property holds the Type of Number for the SmscAddress property. Will be one of these constants.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.SmscTON
    WScript.Echo objGsmDeliveryReport.SmscNPI
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

SmscNPI property

This property holds the Number Plan Identification for the SmscAddress property. Will be one of these constants.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.SmscAddress
    WScript.Echo objGsmDeliveryReport.SmscTON
    WScript.Echo objGsmDeliveryReport.SmscNPI
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

Status property

This is the message delivery status for this message. Will be one of these constants

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.FromAddress
    WScript.Echo objGsmDeliveryReport.Status
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

FromAddress property

The from address in the delivery report will be the address the original SMS message was send to.

Example:

  Set objGsm = CreateObject("AxMmToolkit.Gsm")
  ...
  objGsm.Receive objConst.GSM_MESSAGESTATE_RECEIVED_READ
  ...
  Set objGsmDeliveryReport = objGsm.GetFirstReport
  While objGsm.LastError = 0
    ...
    WScript.Echo objGsmDeliveryReport.FromAddress
    WScript.Echo objGsmDeliveryReport.Status
    ...
    Set objGsmDeliveryReport = objGsm.GetNextReport
  WEnd
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
  Set objGsmDeliveryReport = CreateObject("AxMmToolkit.GsmDeliveryReport")
  ...
  objGsmDeliveryReport.Clear
  ...

5.12. Tlv

Properties

Property Type Read/Write Description
Tag Number Read/Write The 'Tag' value identifies the TLV
Length Number Read The length in bytes of the TLV 'Value' field.
ValueAsString String Read/Write The value represented as a string
ValueAsHexString String Read/Write The value represented as a hexadecimal string
ValueAsInt32 Number Read/Write The value represented as a 32 bit integer
ValueAsInt16 Number Read/Write The value represented as a 16 bit integer
ValueAsInt8 String Read/Write The value represented as an 8 bit integer

Functions

Function Description
Clear Reset all properties to their default values

Tag property

The 'Tag' value identifies the TLV. TLV's are additional, often optional information that can be attached to any of the packets that are specified in the SMPP 3.4 or 5.0 protocol. Here's a list of TLV's that have been proposed in SMPP 3.4. You provider may use other, specific TLV's, find these in the providers documentation.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsString = "Hello, World !"
  WScript.Echo objTlv.Length
  ...

Length property

This is the length in bytes of the TLV 'Value' field. This property is read-only since it's always inferred from the value field.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsString = "Hello, World !"
  WScript.Echo objTlv.Length
  ...

ValueAsString property

Use this property to set or read a TLV Value that is specified as a 'C-Octet' string.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsString = "Hello, World !"
  WScript.Echo objTlv.Length
  ...

ValueAsHexString property

Use this property to set or read a TLV Value that is specified as 'Octet Data' or 'Octet String'.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsString = "Hello, World !"
  WScript.Echo objTlv.Length
  WScript.Echo objTlv.ValueAsHexString
  ...

ValueAsInt32 property

Use this property to set or read a TLV Value that is specified as a '4 Octet' value.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsInt32 = 1
  WScript.Echo objTlv.Length
  WScript.Echo objTlv.ValueAsHexString
  ...

ValueAsInt16 property

Use this property to set or read a TLV Value that is specified as a '2 Octet' value.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsInt16 = 1
  WScript.Echo objTlv.Length
  WScript.Echo objTlv.ValueAsHexString
  ...

ValueAsInt8 property

Use this property to set or read a TLV Value that is specified as an 'Octet' value.

Example:

  Set objTlv = CreateObject("AxMmToolkit.Tlv")   
  objTlv.Tag = 100
  objTlv.ValueAsInt8 = 1
  WScript.Echo objTlv.Length
  WScript.Echo objTlv.ValueAsHexString
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

None

Example:
  Set objTlv = CreateObject("AxMmToolkit.Tlv")
  objTlv.Clear
  objTlv.Tag = 100
  objTlv.ValueAsInt8 = 1
  WScript.Echo objTlv.Length
  WScript.Echo objTlv.ValueAsHexString
  ...

5.13. Snpp

With ActiveXperts SMS and MMS Toolkit, you can send Pager messages via SNPP. SNPP is an OSI Layer-7 IP protocol and stands for Simple Network Paging Protocol. It is a standard for sending wireless messages to paging devices. SNPP provides a simple way to make a link between the Internet and a SNPP compliant paging terminal.

Receive SMS using SMPP

Receive SMS messages on an SMPP connection.

  Set objSmpp = CreateObject("AxMmToolkit.Smpp")             ' Create the SMPP protocol object
  Set objConst = CreateObject("AxMmToolkit.SmsConstants")    ' Create the global constants object

  ' Show version information
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmpp.Version & "; Build " & _
    objSmpp.Build & "; Module " & objSmpp.Module
  WScript.Echo "Expiration date: " & objSmpp.ExpirationDate & vbCrLf

  objSmpp.LogFile = "log.txt"                                 ' Keep a session log

  ' Connect to the remote SMPP server
  objSmpp.Connect "smpp.activexperts-labs.com", 2775, 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    WScript.Quit 1
  End If
   
  ' Create a bind on the SMPP server
  objSmpp.Bind objConst.SMPP_BIND_TRANSCEIVER, "CE658B84", "FAC1982E", "", _
    objConst.SMPP_VERSION_34, 0, 0, "", 2000
  If objSmpp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmpp.GetErrorDescription(objSmpp.LastError)
    objSmpp.Disconnect
    WScript.Quit 1
  End If

  ' While bound, show all incoming messages
  WScript.Echo "Waiting for incoming messages..."
  while objSmpp.IsBound

    Set objMessage = objSmpp.ReceiveMessage()
    While objSmpp.LastError = 0
      If objMessage.SmppIsDeliveryReport Then
        WScript.Echo "Delivery rpt for: " & Left(objMessage.Body, InStr(objMessage.Body, " ")) & _
          "State: " & Mid(objMessage.Body, InStr(objMessage.Body, "stat:")+5, 7)      
      Else
        WScript.Echo "Received toaddress: " & objMessage.ToAddress
        WScript.Echo "Body: " & objMessage.Body      
      End If
      Set objMessage = objSmpp.ReceiveMessage()      
    Wend

    objSmpp.Sleep 1000
  Wend

  WScript.Echo "Done !"

  ' Unbind and disconnect if the server does not disconnect us after unbinding
  objSmpp.Unbind
  objSmpp.Disconnect

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
Server String Read/Write SNPP server host name or IP Address
ServerPort String Read/Write SNPP server TCP port. Default: 444
ServerTimeout String Read/Write SNPP server command timeout in milliseconds. Default: 2000 milliseconds
ProviderUsername String Read/Write Optional username used by SNPP provider
ProviderPassword String Read/Write Optional password used by SNPP provider
ProviderResponse String Read Last response from provider

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Send Send a Pager message.

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSnpp.Version & "; Build " & _
    objSnpp.Build & "; Module " & objSnpp.Module
  WScript.Echo "Expiration date: " & objSnpp.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSnpp.Version & "; Build " & _
    objSnpp.Build & "; Module " & objSnpp.Module
  WScript.Echo "Expiration date: " & objSnpp.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSnpp.Version & "; Build " & _
    objSnpp.Build & "; Module " & objSnpp.Module
  WScript.Echo "Expiration date: " & objSnpp.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objSnpp = CreateObject( "AxMmToolkit.Snpp" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSnpp.Version & "; Build " & _
    objSnpp.Build & "; Module " & objSnpp.Module
  WScript.Echo "Expiration date: " & objSnpp.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objSnpp.SendSms objMessage
  WScript.Echo "Send SMS result: " &  objSnpp.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  objSnpp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objSnpp.SendSms objMessage
  ...

Server property

Sets the host name or TCP/IP address of the SNPP server provider.

Example:

  Set objSnpp = CreateObject(AxMmToolkit.Snpp")
  objSnpp.Server= "snpp.pageallcom.com"                              
  ...
  objSnpp.Send( .. )

ServerPort property

Sets the TCP port for the SNPP connection. This property is optional, the default value is 444.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  objSnpp.Server= "snpp.pageallcom.com"                              
  objSnpp.ServerPort = 4040
  ...
  objSnpp.Send( .. )

ServerTimeout property

Maximum time (in milliseconds) before a Send operation will timeout. Default value: 2000 milliseconds.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")  
  objSnpp.Server= "snpp.pageallcom.com"                              
  objSnpp.ServerTimeout = 5000
  ...
  objSnpp.Send( .. )

ProviderUsername property

The username to be used with the provider

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Set objPagerMessage = CreateObject("AxMmToolkit.PagerMessage")

  objPagerMessage.Recipient = 5551234
  objPagerMessage.Data = "Hello World !!!"

  objSnpp.Server = "snpp.pageallcom.com"
  objSnpp.ServerPort = 444
  objSnpp.ProviderUsername = "secretuser"
  objSnpp.ProviderPassword = "secret"
  objSnpp.Send( objPagerMessage )

  WScript.Echo "Send, result; " & objSnpp.LastError
  WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

ProviderPassword property

The password to be used with the provider.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Set objPagerMessage = CreateObject("AxMmToolkit.PagerMessage")

  objPagerMessage.Recipient = 5551234
  objPagerMessage.Data = "Hello World !!!"

  objSnpp.Server = "snpp.pageallcom.com"
  objSnpp.ServerPort = 444
  objSnpp.ProviderPassword = "secret"
  objSnpp.Send( objPagerMessage )

  WScript.Echo "Send, result; " & objSnpp.LastError
  WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

ProviderResponse property

The last response from the provider. You can use this property for troubleshooting purposes. The property is read-only; you cannot assign a value to it.

Example:

  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Set objPagerMessage = CreateObject("AxMmToolkit.PagerMessage")

  objPagerMessage.Recipient = 5551234
  objPagerMessage.Data = "Hello World !!!"

  objSnpp.Server = "snpp.pageallcom.com"
  objSnpp.ServerPort = 444
  objSnpp.ProviderPassword = "secret"
  objSnpp.Send(objPagerMessage)

  WScript.Echo "Send, result; " & objSnpp.LastError
  WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
            
  objSnpp.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  ....
  objSnpp.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objSnpp = CreateObject("AxMmToolkit.Snpp")   
  objSnpp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"  
  objSnpp.SendSms objMessage
  WScript.Echo "SendSms result: " & objSnpp.LastError & ", " & _
    objSnpp.GetErrorDescription(objSnpp.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  ....
  objSnpp.Sleep 1000
  ...

Send function

Deliver the message to the SMSC provider. The SMSC provider will send the SMS message to the recipient

Parameters:

Return value:

Always 0.

Example:
  Set objSnpp = CreateObject("AxMmToolkit.Snpp")
  Set objPagerMessage = CreateObject("AxMmToolkit.PagerMessage")

  objPagerMessage.Recipient = 5551234
  objPagerMessage.Data = "Hello World !!!"

  objSnpp.Server = "snpp.pageallcom.com"
  objSnpp.ServerPort = 444
  objSnpp.ProviderPassword = "secret"
  objSnpp.Send(objPagerMessage)

  WScript.Echo "Send, result; " & objSnpp.LastError
  WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse

5.14. PagerMessage

Properties

Property Type Read/Write Description
Recipient String Read/Write Recipient's pager ID
Data String Read/Write Pager message text

Functions

Function Description
Clear Clear all properties

Recipient property

The Recipient's Pager ID. If not assigned, the PagerProtocolSnpp.Send function will fail.

Example:

  Set objPagerMessage = CreateObject( "AxMmToolkit.PagerMessage" )            
  ...
  objPagerMessage.Recipient = "+4412345678"
  objPagerMessage.Data = "Hello World !!!"
  ...
  

Data property

The actual message data; only ASCII data is allowed (no binary data, no Unicode).

Example:

  Set objPagerMessage = CreateObject( "AxMmToolkit.PagerMessage" )   
  ...
  objPagerMessage.Recipient = "+4412345678"
  objPagerMessage.Data = "Hello World !!!"
  ...
  

Clear function

This function resets all properties to the initial, default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objPagerMessage = CreateObject( "AxMmToolkit.PagerMessage" )
  ....
  objPagerMessage.Recipient  = "+4412345678"
  objPagerMessage.Clear()
  ...

5.15. Smtp

The Smtp object can be used to connect to a remote SMTP server and send out one or more e-mail messages.

Send e-mail through SMTP

Send an e-mail through the SMTP protocol

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")          ' Create the SMTP Protocol object
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")  ' Create the e-mail message object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmtp.Version & "; Build " & _
    objSmtp.Build & "; Module " & objSmtp.Module
  WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf

  objSmtp.LogFile = "log.txt"                             ' Keep a session log

  ' Open a connection to the SMTP server
  objSmtp.SetSecure
  objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If

  ' Compose an e-mail message
  objMail.FromAddress = "me@gmail.com"
  objMail.FromName = "My Name"
  objMail.Subject = "Hi !"
  objMail.BodyPlainText = "Hello, How are you doing ?"
  objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
  objMail.AddTo "someone@example.com", "Someone"

  ' Send the e-mail
  objSmtp.Send objMail
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)    
  End If

  ' Disconnect from the server
  objSmtp.Disconnect
  WScript.Echo "Done !"

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
HostPort Number Read/Write The host port of the SMTP server to connect to
Authentication Number Read/Write The SMTP authentication method
UseStartTls Boolean Read/Write Use a secure connection if possible
LastSmtpResponse String Read Last SMTP response from the server
TimeoutConnect Number Read/Write Timeout (msecs) for a connection to be established
TimeoutAuthentication Number Read/Write Timeout (msecs) to authenticate
TimeoutCommand Number Read/Write Timeout (msecs) for each SMTP command to complete
TimeoutData Number Read/Write Timeout (msecs) for the SMTP DATA command to complete

Functions

Function Description
Activate Activate the product
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
Connect Connect to the SMTP server
Disconnect Disconnect from the SMTP server
Send Send an e-mail message
SetSecure Enables TLS/SSL and sets the correct port number

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmtp.Version & "; Build " & _
    objSmtp.Build & "; Module " & objSmtp.Module
  WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmtp.Version & "; Build " & _
    objSmtp.Build & "; Module " & objSmtp.Module
  WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmtp.Version & "; Build " & _
    objSmtp.Build & "; Module " & objSmtp.Module
  WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objSmtp = CreateObject( "AxMmToolkit.Smtp" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objSmtp.Version & "; Build " & _
    objSmtp.Build & "; Module " & objSmtp.Module
  WScript.Echo "Expiration date: " & objSmtp.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objSmtp.SendSms objMessage
  WScript.Echo "Send SMS result: " &  objSmtp.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  objSmtp.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objSmtp.SendSms objMessage
  ...

HostPort property

This is the host port of the SMTP server to connect to. Set this property if the port is different from the standard SMTP port (25).

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...
  objSmtp.HostPort = 8025
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

Authentication property

This is the authentication method that should be used. By default the preferred authentication method will be automatically detected.

Use one of these constants.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objConst = CreateObject("AxMmToolkit.EmailConstants")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...
  objSmtp.Authentication = objConst.SMTP_AUTH_MD5CRAM
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

UseStartTls property

Use a secure connection if supported by the SMTP server.
If the proprty is set to True, Connect will start a secure connection if the SMTP server supports it.
If the proprty is set to False, Connect will NOT start a secure connection, even in case the SMTP does support it.

Example:

  Set objSmtp = CreateObject("ActiveEmail.Smtp")
  Set objConst = CreateObject("ActiveEmail.EmailConstants")
  ...
  Set objSmtp.UseStartTls = False
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

LastSmtpResponse property

The last SMTP response from the server.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objConst = CreateObject("AxMmToolkit.EmailConstants")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...  
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  WScript.Echo "Server response: " & objSmtp.LastSmtpResponse
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

TimeoutConnect property

Timeout (in milliseconds) for a connection to be established.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ...  
  objSmtp.TimeoutConnect = 10000
  objSmtp.Connect "smtp.example.com", "", ""
  WScript.Echo "Server response: " & objSmtp.LastSmtpResponse
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

TimeoutAuthentication property

Timeout (in milliseconds) to authenticate to the SMTP mail server.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ...  
  objSmtp.TimeoutAuthentication = 10000  
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  WScript.Echo "Server response: " & objSmtp.LastSmtpResponse
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

TimeoutCommand property

Timeout (in milliseconds) for each SMTP command to complete. This applies to all SMTP commands (e.g.: AUTH, RCPT TO, QUIT) except the DATA command.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ...  
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  ... 
  objSmtp.TimeoutCommand = 5000  
  objSmtp.Send( objMail )
  ...

TimeoutData property

Timeout (msecs) for the SMTP DATA command to complete.

Example:

  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ...  
  objSmtp.Connect "smtp.example.com", "me@example.com", "password"
  ...  
  objSmtp.TimeoutData = 120000   
  objSmtp.Send( objMail )
  ...

Activate function

This function activates the Mobile Messaging Toolkit product. A valid registration code should be passed as parameter.

Parameters:

  • The registration key
  • Persistent - this optional Boolean variable (default: True) specifies whether you want to add the registration key to the registry. If you pass 'True', you need to call the 'Activate' function only once for that computer. If you pass 'False', you need to call 'Activate' each time you create the object on that computer. This can be useful for customers who own a Distribution License of the product but do not want to show the registration key to their customers (see also here).

Return value:

Always 0. Check LastError property to see if the function was completed successfully.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")   
            
  objSmtp.Activate "xxxxx-xxxxx-xxxxx", True
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")   
  ....
  objSmtp.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ...
  WScript.Echo "result: " & objSmtp.LastError & ", " & _
    objSmtp.GetErrorDescription(objSmtp.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  ....
  objSmtp.Sleep 1000
  ...

Connect function

This function connects to the specified SMTP server

Parameters:

  • Hostname
  • Account name
  • Password

Return value:

Always 0.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...  
  objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

Disconnect function

This function disconnects from the SMTP server

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...  
  objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...
  objSmtp.Disconnect

Send function

This functions sends the specified e-mail.

Parameters:

  • EMail object

Return value:

Always 0.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...
  objMail.BodyPlainText = "Hello, How are you doing ?"
  objMail.BodyHtml = "<html><body><h2>Hello</h2><p>How are you doing ?</p></body></html>"
  objMail.AddTo "someone@example.com", "Someone"
  ...
  objSmtp.Send objMail
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)    
  End If
  ...

SetSecure function

This function makes sure TLS/SSL is enabled and the port number to connect on is set correctly.

Parameters:

  • (Optional) Port number, default: 465

Return value:

Always 0.

Example:
  Set objSmtp = CreateObject("AxMmToolkit.Smtp")
  Set objMail = CreateObject("AxMmToolkit.EmailMessage")
  ...  
  objSmtp.SetSecure
  objSmtp.Connect "smtp.gmail.com", "me@gmail.com", "password"
  If objSmtp.LastError <> 0 Then
    WScript.Echo "Error: " & objSmtp.GetErrorDescription(objSmtp.LastError)  
    WScript.Quit
  End If
  ...

5.16. Pop3

The Pop3 object can be used to connect to a POP3 server and receive e-mail messages.

Receive e-mails through POP3

Receive e-mail messages through the POP3 protocol

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")          ' Create the POP3 protocol object

  Wscript.Echo "Mobile Messaging Toolkit Version " & objPop3.Version & "; Build " & _
    objPop3.Build & "; Module " & objPop3.Module
  WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf

  objPop3.LogFile = "log.txt"                             ' Keep a session log

  ' Open a connection to the POP3 server
  objPop3.SetSecure
  objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If

  ' Retrieve all new messages
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  
    
    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText
    
    For j = 1 to objMail.CountAttachments()
      strName = objMail.GetAttachmentName(j)
      WScript.Echo "  Attachment found: " & strName
      ' Uncomment the following lines to save the attachments.
      'strPath = "C:\Temp\" & strName
      'WScript.Echo "  Saving attachment to : " & strPath
      'objMail.SaveAttachment j, strPath
    Next    
  Next

  objPop3.Disconnect
  WScript.Echo "Disconnected"

Properties

Property Type Read/Write Description
Version String Read Version number of the Mobile Messaging Toolkit
Build String Read Build number of the Mobile Messaging Toolkit
Module String Read Module name of the Mobile Messaging Toolkit
ExpirationDate String Read Expiration date of the Mobile Messaging Toolkit
LastError Number Read Result of the last called method
LogFile String Read/Write The path to a logfile which can be used for troubleshooting
HostPort Number Read/Write The host port for the POP3 server
Authentication Number Read/Write The authentication method
LastPop3Response String Read/Write Last POP3 response from the server
TimeoutConnect Number Read/Write Timeout (msecs) for a connection to be established
TimeoutAuthentication Number Read/Write Timeout (msecs) to authenticate
TimeoutCommand Number Read/Write Timeout (msecs) for each POP3 command to complete
TimeoutData Number Read/Write Timeout (msecs) for the POP3 RETR command to complete

Functions

Function Description
Clear Reset all properties to their default values
GetErrorDescription Get the description of the given error
Sleep Sleep for the specified number of milliseconds
SetSecure Enable TLS/SSL and set the correct port number
Connect Connect to the specified POP3 server
Disconnect Disconnect from the POP3 server
IsConnected Returns the connected state
CountMessages Count the number of messages in the mail-drop
DeleteMessage Delete a message from the mail-drop
GetEmailHeader Retrieve the e-mail header
GetEmailMessage Retrieve the e-mail message

Version property

Return the version number of the Mobile Messaging Toolkit

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objPop3.Version & "; Build " & _
    objPop3.Build & "; Module " & objPop3.Module
  WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
  ...

Build property

Return the build number of the Mobile Messaging Toolkit.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objPop3.Version & "; Build " & _
    objPop3.Build & "; Module " & objPop3.Module
  WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
  ...

Module property

Return the module name of the Mobile Messaging Toolkit.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  Wscript.Echo "Mobile Messaging Toolkit Version " & objPop3.Version & "; Build " & _
    objPop3.Build & "; Module " & objPop3.Module
  WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
  ...

ExpirationDate property

Return the expiration date of the Mobile Messaging Toolkit.

Example:

  Set objPop3 = CreateObject( "AxMmToolkit.Pop3" )
  Wscript.Echo "Mobile Messaging Toolkit Version " & objPop3.Version & "; Build " & _
    objPop3.Build & "; Module " & objPop3.Module
  WScript.Echo "Expiration date: " & objPop3.ExpirationDate & vbCrLf
  ...

LastError property

Completion code of the last called function. To find the error description of a given error code, go to the online error codes codes page.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...  
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objPop3.SendSms objMessage
  WScript.Echo "Send SMS result: " &  objPop3.LastError    ' Is our message sent ?  
  ...

LogFile property

By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the Mobile Messaging Toolkit will write debug information to this file. Output data is written at the end of the file, the file is not cleared.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.LogFile = "C:\temp\log.txt"
  ...
  Set objMessage = CreateObject("AxMmToolkit.SmsMessage")
  objMessage.ToAddress = "+31611223344"
  objMessage.Body = "Short text message"
  objPop3.SendSms objMessage
  ...

HostPort property

Set the host port to connect to. By default this is 110.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.HostPort = 8110
  objPop3.Connect "pop.example.com", "me@example.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

Authentication property

Set the authentication method to use on the POP3 server. By default it will autodetect the preferred method.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.Authentication = POP3_AUTH_PLAIN
  objPop3.Connect "pop.example.com", "me@example.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

LastPop3Response property

Last POP3 response from the server.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  
  objPop3.Connect "pop.example.com", "me@example.com", "password"
  WScript.Echo "Server reponse: " & objPop3.LastPop3Response
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

TimeoutConnect property

Timeout (in milliseconds) for a connection to be established.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.TimeoutConnect = 10000
  objPop3.Connect "pop.example.com", "me@example.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

TimeoutAuthentication property

Timeout (in milliseconds) to authenticate to the POP3 mail server.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.TimeoutAuthentication = 10000
  objPop3.Connect "pop.example.com", "me@example.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

TimeoutCommand property

Timeout (in milliseconds) for each POP3 command to complete. This applies to all POP3 commands (e.g.: APOP, CAPA, QUIT) except the RETR command.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.TimeoutCommand = 10000      
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  

    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText
  Next
  ...

TimeoutData property

Timeout (msecs) for the POP3 RETR command to complete.

Example:

  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  objPop3.TimeoutData = 120000      
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  

    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText
  Next
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")   
  ....
  objPop3.Clear
  ...

GetErrorDescription function

GetErrorDescription provides the error description of a given error code.

Parameters:

  • The error code

Return value:

The error string.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  WScript.Echo "result: " & objPop3.LastError & ", " & _
    objPop3.GetErrorDescription(objPop3.LastError)

Sleep function

This function suspends the current thread for the specified number of milliseconds.

Parameters:

  • Milliseconds to sleep

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  objPop3.Sleep 1000
  ...

SetSecure function

This function enables TLS/SSL and sets the correct port number.

Parameters:

  • Port number. Default: 995

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  objPop3.SetSecure
  objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

Connect function

This function connects to the POP3 server.

Parameters:

  • Hostname
  • Account
  • Password

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...  
  objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...

Disconnect function

This function disconnects from the POP3 server.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...  
  objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...
  objPop3.Disconnect

IsConnected function

This function returns the connected state. True is connected, False if not connected.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...  
  objPop3.Connect "pop.gmail.com", "me@gmail.com", "password"
  If objPop3.LastError <> 0 Then
    WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
    WScript.Quit
  End If
  ...
  WScript.Echo objPop3.IsConnected
  ...
  objPop3.Disconnect

CountMessages function

This function requests the number of messages in the mail drop.

Parameters:

  • None

Return value:

The number of messages in the mail-drop

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  
    
    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText    
  Next
  ...

DeleteMessage function

This function deletes a message from the mail-drop. This prevents the mail server from including this e-mail on the next connect.

Parameters:

  • Message Id

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  
    
    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText
    
    objPop3.DeleteMessage objMessage.ID
  Next
  ...

GetEmailHeader function

This function only returns the e-mail header. On most mail servers this will be faster than retrieving the entire message body.

Parameters:

  • Message Id

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailHeader(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  
    
    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject    
  Next
  ...

GetEmailMessage function

This function retrieves the e-mail message

Parameters:

  • Message Id

Return value:

Always 0.

Example:
  Set objPop3 = CreateObject("AxMmToolkit.Pop3")
  ...
  For i = 1 to objPop3.CountMessages()
    Set objMail = objPop3.GetEmailMessage(i)
    If objPop3.LastError <> 0 Then
      WScript.Echo "Error: " & objPop3.GetErrorDescription(objPop3.LastError)  
      objPop3.Disconnect
      WScript.Quit
    End If  
    
    WScript.Echo "--------------------------------------------------------------"
    WScript.Echo objMail.Date
    WScript.Echo objMail.FromAddress
    WScript.Echo objMail.Subject
    WScript.Echo objMail.BodyPlainText
  Next
  ...

5.17. EMailMessage

The EMailMessage object represents an e-mail message. The POP3 protocol receives e-mail messages and the SMTP protocol can be used to send e-mail messages.

Properties

Property Type Read/Write Description
LastError Number Read Result of the previously called function
Subject String Read/Write The Subject of the message
BodyPlainText String Read/Write The plain-text body of the message
BodyHtml String Read/Write The html body of the message
Priority Number Read/Write The Priority of the message.
FromName String Read/Write The sender's name
FromAddress String Read/Write The sender's e-mail address
ReplyAddress String Read/Write The Sender's reply-address.
ReadReceiptAddress String Read/Write E-mail address to send a read receipt to
Organization String Read/Write The sender's organization name
MessageSource String Read The source of the e-mail message
MessageHeader String Read The header of the e-mail message
Size Number Read The sender's organization name
Date String Read The e-mail date
ToAddress String Read The 'To' address(es)
CcAddress String Read The 'Cc' address(es)
BccAddress String Read The 'Bcc' address(es)
Encoding Number Read/Write SMTP specific. Encoding used to send create this message
ID Number Read POP3 specific, The e-mail index on the server

Functions

Function Description
Clear Reset all properties to their default values
AddHeader Add an additional header value to the e-mail
GetHeaderValue Get a header value from the e-mail
AddTo Add an e-mail recipient
AddCc Add a 'Carbon Copy' recipient
AddBcc Add a 'Blind Carbon Copy' recipient
AddAttachment Add an attachment to the e-mail
CountAttachments Number of attachments attached to the e-mail
GetAttachmentName Get the name of an attachment
GetAttachmentSize Get the size of an attachment
SaveAttachment Save the attachment to a file
Encode Encode an e-mail to mime
Decode Decode the given e-mail
LoadMIME Load a MIME file
SaveMIME Save a MIME file

LastError property

This read-only property indicates the result of the last called function. A zero indicates: success. Any non-zero value means an error.

For a complete list of error codes, check out the following page: www.activexperts.com/support/errorcodes.

Example:

  Set objSmtpMail = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.AddAttachment( "C:\File.txt" )
  WScript.Echo "Result code: " & objEMailMessage.LastError
  ...

Subject property

This is the subject of the e-mail message.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.Subject = "This is an important message"
  ...

BodyPlainText property

This is the plain text body of the message. When sending e-mail, set this property to the plain text part of the e-mail message. When receiving e-mail, this property will be set to the plain text part if a plain text part is available.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  Set objConstants = CreateObject("AxMmToolkit.EMailConstants")
  ...
  objEMailMessage.AddAttachment "C:\MySelf.jpg"
  objEMailMessage.AddAttachment "C:\MyWife.jpg"
  objEMailMessage.BodyPlainText = "Find a picture of myself and my wife attached to this e-mail."
  objEMailMessage.BodyHtml = "<html><body>This <img SRC="cid:1"> is me" &_
                             "<br>and <img SRC="cid:2"> my wife<br></body></html>"
  ...

BodyHtml property

This is the HTML body of the message. When sending e-mail, set this property to the HTML part of the e-mail message. When receiving e-mail, this property will be set to the HTML part if a HTML part is available.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  Set objConstants = CreateObject("AxMmToolkit.EMailConstants")
  ...
  objEMailMessage.AddAttachment "C:\MySelf.jpg"
  objEMailMessage.AddAttachment "C:\MyWife.jpg"
  objEMailMessage.BodyPlainText = "Find a picture of myself and my wife attached to this e-mail."
  objEMailMessage.BodyHtml = "<html><body>This <img SRC="cid:0000001"> is me" &_
                             "<br>and <img SRC="cid:0000002"> my wife<br></body></html>"
  ...

Priority property

The e-mail priority. This can be used by the e-mail client, such as outlook, to control how to display this e-mail.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  Set objConstants = CreateObject("AxMmToolkit.EMailConstants")
  ...
  objEMailMessage.Priority =  objConstants.EMAIL_MESSAGE_PRIORITY_HIGH
  ...

FromName property

The name of the e-mail sender. This file can be left empty.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.FromAddress = "me@mydomain.doc"
  objEMailMessage.FromName = "This is Me"
  ...

FromAddress property

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.FromAddress = "me@mydomain.doc"
  objEMailMessage.FromName = "This is Me"
  ...

ReplyAddress property

The sender's reply address. If this is left empty the from address will be used as the reply address.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.ReplyAddress = "myself@mydomain.com"
  ...

ReadReceiptAddress property

E-mail address of the person who should receive a 'read receipt'. The receipt is sent when the message recipient has displayed your message. This is useful when you are sending time-critical information, or any time you want confirmation that your message has been received.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.ReadReceiptAddress = "myself@mydomain.com"
  ...

Organization property

This is the sender name of the organization of the sender.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  objEMailMessage.Organization = "My Organization"
  ...

MessageSource property

This is the source of the e-mail message.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.MessageSource
  ...

MessageHeader property

This is the header of the e-mail message.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.MessageHeader
  ...

Size property

This is the sender name of the organization of the sender.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.Size
  ...

Date property

This returns the e-mail date field.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.Date
  ...

ToAddress property

Returns a 'comma seperated' string of 'To' addresses for this e-mail.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.ToAddress
  WScript.Echo objEMailMessage.CcAddress
  WScript.Echo objEMailMessage.BccAddress
  ...

CcAddress property

Returns a 'comma seperated' string of 'Cc' addresses for this e-mail.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.ToAddress
  WScript.Echo objEMailMessage.CcAddress
  WScript.Echo objEMailMessage.BccAddress
  ...

BccAddress property

Returns a 'comma seperated' string of 'Bcc' addresses for this e-mail.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.ToAddress
  WScript.Echo objEMailMessage.CcAddress
  WScript.Echo objEMailMessage.BccAddress
  ...

Encoding property

When creating a message using a specific extended ASCII encoding, like ISO-8859-6 (Arabic), use this property to set the encoding to the proper value.

Use one of these values.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  Set objConstants = CreateObject("AxMmToolkit.EMailConstants")
  ...
  objEMailMessage.Encoding = objConstants.EMAIL_MESSAGE_ENCODING_ARABIC
  ...

ID property

This is the index in the mail-drop on the POP3 server.

Example:

  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")
  ...
  WScript.Echo objEMailMessage.ID  
  ...

Clear function

This function resets all properties to their default values.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.Clear
  ...

AddHeader function

This function will add a header value to the e-mail.

Parameters:

  • Name
  • Value

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.AddHeader "X-Bender", "Bite my shiny metal ass."
  ...

GetHeaderValue function

This function returns the given header value if it can be found.

Parameters:

  • None

Return value:

The header value.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  WScript.Echo objEMailMessage.GetHeader("X-UIDL")
  ...

AddTo function

This functions adds an e-mail recipient to the e-mail.

Parameters:

  • E-mail address
  • Display name

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.AddTo "someone@example.com", "Someone"
  objEMailMessage.AddCc "myboss@example.com", "My Boss"
  objEMailMessage.AddBcc "coworker@example.com", "Co Worker"
  ...

AddCc function

This function adds a recipient to the 'Carbon Copy' (CC) list.

Parameters:

  • E-mail address
  • Display name

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.AddTo "someone@example.com", "Someone"
  objEMailMessage.AddCc "myboss@example.com", "My Boss"
  objEMailMessage.AddBcc "coworker@example.com", "Co Worker"
  ...

AddBcc function

This function adds a recipient to the 'Blind Carbon Copy' (BCC) list

Parameters:

  • E-mail address
  • Display name

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.AddTo "someone@example.com", "Someone"
  objEMailMessage.AddCc "myboss@example.com", "My Boss"
  objEMailMessage.AddBcc "coworker@example.com", "Co Worker"
  ...

AddAttachment function

This function adds an attachment to the e-mail.

Parameters:

  • Filename of the attachment

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.AddAttachment "C:\Temp\file.zip"
  If objEMailMessage.LastError <> 0 Then
    WScript.Echo "Error: " & objEMailMessage.GetErrorDescription(objEmailMessage.LastError)
  End If
  ...

CountAttachments function

This function counts the number of attachments on this e-mail

Parameters:

  • none

Return value:

The number of attachments

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  For j = 1 to objMail.CountAttachments()
    strName = objMail.GetAttachmentName(j)
    WScript.Echo "  Attachment found: " & strName
    strPath = "C:\Temp\" & strName
    WScript.Echo "  Saving attachment to : " & strPath
    objMail.SaveAttachment j, strPath
  Next  
  ...

GetAttachmentName function

This function returns the filename of the attachment identified by the given ID. If the filename is not available it will return the name of the attachment.

The ID of the attachment ranges from 1 to CountAttachments

Parameters:

  • Attachment ID

Return value:

The name of the attachment

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  For j = 1 to objMail.CountAttachments()
    strName = objMail.GetAttachmentName(j)
    WScript.Echo "  Attachment found: " & strName
    strPath = "C:\Temp\" & strName
    WScript.Echo "  Saving attachment to : " & strPath
    objMail.SaveAttachment j, strPath
  Next  
  ...

GetAttachmentSize function

This function returns the size of the attachment identified by the given ID. This is the size of the attachment before it is decoded.

The ID of the attachment ranges from 1 to CountAttachments

Parameters:

  • Attachment ID

Return value:

The size of the attachment

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  For j = 1 to objMail.CountAttachments()
    strName = objMail.GetAttachmentName(j)
    WScript.Echo "  Attachment found: " & strName & "; Size: " & objMail.GetAttachmentSize(j)
    strPath = "C:\Temp\" & strName
    WScript.Echo "  Saving attachment to : " & strPath
    objMail.SaveAttachment j, strPath
  Next  
  ...

SaveAttachment function

This function saves the attachment identified by the given Id.

The ID of the attachment ranges from 1 to CountAttachments

Parameters:

  • Attachment ID
  • Filename to save the attachment to

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  For j = 1 to objMail.CountAttachments()
    strName = objMail.GetAttachmentName(j)
    WScript.Echo "  Attachment found: " & strName
    strPath = "C:\Temp\" & strName
    WScript.Echo "  Saving attachment to : " & strPath
    objMail.SaveAttachment j, strPath
  Next  
  ...

Encode function

This function actually encodes the e-mail to the MIME format.

If you are creating a MIME encoded message to send it out at a later time always call this function before calling SaveMIME.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.Encode
  ...

Decode function

This function will decode a MIME file.

This function is automatically called when receiving or loading a MIME encoded message. This function never needs to be called.

Parameters:

  • None

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.Decode
  ...

LoadMIME function

This function loads a MIME encoded e-mail from file.

Parameters:

  • The file name to load from

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.LoadMIME "C:\Temp\Test.mime"
  If objEMailMessage.LastError <> 0 Then
    WScript.Echo "Error: " & objEMailMessage.GetErrorDescription(objEmailMessage.LastError)
  End If  
  ...

SaveMIME function

This function saves a MIME encoded file

Parameters:

  • The filename to save to

Return value:

Always 0.

Example:
  Set objEMailMessage = CreateObject("AxMmToolkit.EMailMessage")   
  ...
  objEMailMessage.SaveMIME "C:\Temp\Test.mime"
  If objEMailMessage.LastError <> 0 Then
    WScript.Echo "Error: " & objEMailMessage.GetErrorDescription(objEmailMessage.LastError)
  End If  
  ...

5.18. SmsConstants

TON (Type Of Number) definitions

Constant Value Description
TON_UNKNOWN 0 Unknown
TON_INTERNATIONAL 1 International
TON_NATIONAL 2 National
TON_NETWORK_SPECIFIC 3 Network specific
TON_SUBSCRIBER_NUMBER 4 Subscriber number
TON_ALPHANUMERIC 5 Alphanumeric
SMPP_TON_ABBREVIATED 6 Abbreviated

NPI (Number Plan Identification) definitions

Constant Value Description
NPI_UNKNOWN 0 Unknown
NPI_ISDN 1 ISDN
NPI_DATA 3 Data
NPI_TELEX 4 Telex
NPI_NATIONAL 8 National
NPI_PRIVATE 9 Private
NPI_ERMES 10 Ermes
SMPP_NPI_INTERNET 14 Internet

Multipart definitions

Constant Value Description
MULTIPART_OK 0 Send long messages as multipart
MULTIPART_TRUNCATE 1 Truncate long messages
MULTIPART_ERROR 2 Fail messages that are to long

Body format definitions

Constant Value Description
BODYFORMAT_TEXT 0 The message body is unformatted text
BODYFORMAT_HEX 2 The message body is formatted as HEX data (e.g.: '10abcdef')

Datacoding definitions

Constant Value Description
DATACODING_DEFAULT 0 Default
DATACODING_8BIT_DATA 4 8Bit data
DATACODING_UNICODE 8 Unicode
DATACODING_FLASH 16 Flash
GSM_DATACODING_ME_SPECIFIC 1 (GSM only) ME Specific
GSM_DATACODING_SIM_SPECIFIC 2 (GSM only) SIM Specific
GSM_DATACODING_TE_SPECIFIC 3 (GSM only) TE Specific
SMPP_DATACODING_ASCII 1 (SMPP only) IA5 (CCITT T.50)/ASCII (ANSI X3.4)
SMPP_DATACODING_OCTET_UNSPEC 2 (SMPP only) Octet unspecified (8-bit binary)
SMPP_DATACODING_LATIN 3 (SMPP only) Latin 1 (ISO-8859-1)
SMPP_DATACODING_JIS_KANJI 5 (SMPP only) JIS (X 0208-1990)
SMPP_DATACODING_CYRILLIC 6 (SMPP only) Cyrllic (ISO-8859-5)
SMPP_DATACODING_LATIN_HEBREW 7 (SMPP only) Latin/Hebrew (ISO-8859-8)
SMPP_DATACODING_UNICODE 8 (SMPP only) UCS2 (ISO/IEC-10646)
SMPP_DATACODING_PICTOGRAM 9 (SMPP only) Pictogram Encoding
SMPP_DATACODING_ISO_2022_JP 10 (SMPP only) ISO-2022-JP (Music Codes)
SMPP_DATACODING_EXTENDED_KANJI_JIS 13 (SMPP only) Extended Kanji JIS(X 0212-1990)
SMPP_DATACODING_KS_C_5601 14 (SMPP only) KS C 5601

Baudrate definitions

Constant Value Description
GSM_BAUDRATE_110 110 110 bps
GSM_BAUDRATE_300 300 300 bps
GSM_BAUDRATE_600 600 600 bps
GSM_BAUDRATE_1200 1200 1200 bps
GSM_BAUDRATE_2400 2400 2400 bps
GSM_BAUDRATE_4800 4800 4800 bps
GSM_BAUDRATE_9600 9600 9600 bps
GSM_BAUDRATE_14400 14400 14400 bps
GSM_BAUDRATE_19200 19200 19200 bps
GSM_BAUDRATE_38400 38400 38400 bps
GSM_BAUDRATE_56000 56000 56000 bps
GSM_BAUDRATE_57600 57600 57600 bps
GSM_BAUDRATE_64000 64000 64000 bps
GSM_BAUDRATE_115200 115200 115200 bps
GSM_BAUDRATE_128000 128000 128000 bps
GSM_BAUDRATE_230400 230400 230400 bps
GSM_BAUDRATE_256000 256000 256000 bps
GSM_BAUDRATE_460800 460800 460800 bps
GSM_BAUDRATE_921600 921600 921600 bps

GSM first octet definitions

Constant Value Description
GSM_FO_REPLYPATH_EXISTS 128 Reply path exists
GSM_FO_UDHI 64 UDH Indicator
GSM_FO_STATUS_REPORT 32 Status report
GSM_FO_VALIDITY_NONE 0 Validity none
GSM_FO_VALIDITY_RELATIVE 16 Validity relative
GSM_FO_VALIDITY_ENHANCED 8 Validity enhanced
GSM_FO_VALIDITY_ABSOLUTE 24 Validity absolute
GSM_FO_REJECT_DUPLICATES 4 Reject duplicates
GSM_FO_SUBMIT_SM 1 Submit SM
GSM_FO_DELIVER_SM 0 Deliver SM
GSM_FO_STATUS_SM 2 Status SM

GSM message status definitions

Constant Value Description
GSM_STATUS_MESSAGE_DELIVERED_SUCCESSFULLY 0x00 Message delivered successfully
GSM_STATUS_FORWARDED_STATUS_UNKNOWN 0x01 Forwarded status unknown
GSM_STATUS_REPLACED 0x02 Replaced
GSM_STATUS_CONGESTION_STILL_TRYING 0x20 Congestion, still trying
GSM_STATUS_RECIPIENT_BUSY_STILL_TRYING 0x21 Recipient busy, still trying
GSM_STATUS_NO_RESPONSE_STILL_TRYING 0x22 No response, still trying
GSM_STATUS_SERVICE_REJECTED_STILL_TRYING 0x23 Service rejected, still trying
GSM_STATUS_QOS_NOT_AVAILABLE_STILL_TRYING 0x24 QOS not available, still trying
GSM_STATUS_RECIPIENT_ERROR_STILL_TRYING 0x25 Recipient error, still trying
GSM_STATUS_RPC_ERROR 0x40 RCP error
GSM_STATUS_INCOMPATIBLE_DESTINATION 0x41 Incompatible destination
GSM_STATUS_CONNECTION_REJECTED 0x42 Connection rejected
GSM_STATUS_NOT_OBTAINABLE 0x43 Not obtainable
GSM_STATUS_QOS_NOT_AVAILABLE 0x44 QOS not available
GSM_STATUS_NO_INTERNETWORKING_AVAILABLE 0x45 No internetworking available
GSM_STATUS_MESSAGE_EXPIRED 0x46 Message expired
GSM_STATUS_MESSAGE_DELETED_BY_SENDER 0x47 Message deleted by sender
GSM_STATUS_MESSAGE_DELETED_BY_SMSC 0x48 Message deleted by SMSC
GSM_STATUS_DOES_NOT_EXIST 0x49 Does not exist

GSM memory state definitions

Constant Value Description
GSM_MESSAGESTATE_RECEIVED_UNREAD 0 Received unread
GSM_MESSAGESTATE_RECEIVED_READ 1 Received read
GSM_MESSAGESTATE_STORED_UNSENT 2 Stored unsent
GSM_MESSAGESTATE_STORED_SENT 3 Stored sent
GSM_MESSAGESTATE_ALL 4 All

GSM storage type definitions

Constant Value Description
GSM_STORAGETYPE_SIM 1 SIM storage ('SM')
GSM_STORAGETYPE_MEMORY 2 Memory storage ('ME')
GSM_STORAGETYPE_COMBINED 3 Combined storage ('MT')
GSM_STORAGETYPE_STATUS 4 Status reports storage ('SR')
GSM_STORAGETYPE_ALL 5 Use all storage types

GSM message format definitions

Constant Value Description
GSM_MESSAGEFORMAT_PDU 0 PDU mode
GSM_MESSAGEFORMAT_TEXT 1 Text mode
GSM_MESSAGEFORMAT_AUTO 2 Auto detect

GSM prefix SMSC definitions

Constant Value Description
GSM_PREFIXSMSC_ENABLED 0 Enabled
GSM_PREFIXSMSC_DISABLED 1 Disabled
GSM_PREFIXSMSC_AUTO 2 Auto detect

SMPP bind definitions

Constant Value Description
SMPP_BIND_TRANSMITTER 1 Bind as transmitter
SMPP_BIND_TRANSCEIVER 2 Bind as transceiver
SMPP_BIND_RECEIVER 3 Bind as receiver

SMPP version definitions

Constant Value Description
SMPP_VERSION_33 0x33 Version 3.3
SMPP_VERSION_34 0x34 Version 3.4
SMPP_VERSION_50 0x50 Version 5.0

SMPP ESM definitions

Constant Value Description
SMPP_ESM_2ESME_DEFAULT 0 Default
SMPP_ESM_2ESME_DELIVERY_RECEIPT 4 SMSC delivery receipt
SMPP_ESM_2ESME_DELIVERY_ACK 8 SME delivery ACK
SMPP_ESM_2ESME_MANUAL_ACK 16 SME manual ACK
SMPP_ESM_2ESME_CONVERSATION_ABORT 18 Conversation abort
SMPP_ESM_2ESME_INTERMEDIATE_DELIVERY_NOTIFY 32 Intermediate delivery notify
SMPP_ESM_2SMSC_MODE_DEFAULT 0 Mode default
SMPP_ESM_2SMSC_MODE_STOREFORWARD 3 Mode store and forward
SMPP_ESM_2SMSC_MODE_DATAGRAM 1 Mode datagram
SMPP_ESM_2SMSC_MODE_FORWARD 2 Mode forward
SMPP_ESM_2SMSC_TYPE_DEFAULT 0 Type default
SMPP_ESM_2SMSC_TYPE_DELIVERY_ACK 8 Type delivery ACK
SMPP_ESM_2SMSC_TYPE_MANUAL_ACK 16 Type manual ACK
SMPP_ESM_2SMSC_FEAT_NOTHING 0 Feat nothing
SMPP_ESM_2SMSC_FEAT_UDHI 64 Feat User Data Indicator
SMPP_ESM_2SMSC_FEAT_SRP 128 Feat Set Reply Path

SMPP priority definitions

Constant Value Description
SMPP_PRIORITYFLAG_BULK 0 Bulk
SMPP_PRIORITYFLAG_NORMAL 1 Normal
SMPP_PRIORITYFLAG_URGENT 2 Urgent
SMPP_PRIORITYFLAG_VERY_URGENT 3 Very urgent

SMPP message state definitions

Constant Value Description
SMPP_MESSAGESTATE_AX_WAITRESP 0 Waiting for server response
SMPP_MESSAGESTATE_ENROUTE 1 Enroute
SMPP_MESSAGESTATE_DELIVERED 2 Delivered
SMPP_MESSAGESTATE_EXPIRED 3 Expired
SMPP_MESSAGESTATE_DELETED 4 Deleted
SMPP_MESSAGESTATE_UNDELIVERABLE 5 Undeliverable
SMPP_MESSAGESTATE_ACCEPTED 6 Accepted
SMPP_MESSAGESTATE_UNKNOWN 7 Unknown
SMPP_MESSAGESTATE_REJECTED 8 Rejected
SMPP_MESSAGESTATE_AX_RESPERROR 96 Error in response
SMPP_MESSAGESTATE_AX_NOCREDITS 97 Out of credits (ActiveXperts demo gateway)
SMPP_MESSAGESTATE_AX_RESPTO 98 Timeout in response
SMPP_MESSAGESTATE_AX_RESPONDED 99 Message accepted

SMPP Multipart Mode definitions

Constant Value Description
SMPP_MULTIPARTMODE_UDH 1 Split up using UDH and 8 bit reference number
SMPP_MULTIPARTMODE_UDH16BIT 2 Split up using UDH and 16 bit reference number
SMPP_MULTIPARTMODE_SARTLV 3 Split up using 'SMPP_TLV_SAR_MSG_REF_NUM', 'SMPP_TLV_SAR_TOTAL_SEGMENTS' and 'SMPP_TLV_SAR_SEGMENT_SEQNUM' TLV's
SMPP_MULTIPARTMODE_PAYLOADTLV 4 Send entire body as 'SMPP_TLV_MESSAGE_PAYLOAD' TLV

SMPP Submit Mode definitions

Constant Value Description
SMPP_SUBMITMODE_SUBMITSM 1 Send outgoing SMS messages using the 'submit_sm' command
SMPP_SUBMITMODE_DATASM 2 Send outgoing SMS messages using the 'data_sm' command

SMPP Use GSM encoding definitions

Constant Value Description
SMPP_USEGSMENCODING_DISABLED 0 GSM encoding/decoding disabled
SMPP_USEGSMENCODING_INCOMING -1 Incoming messages are decoded (7bit)
SMPP_USEGSMENCODING_OUTGOING -2 Outgoing messages are encoded (7bit)
SMPP_USEGSMENCODING_INANDOUT -3 In- and outgoing messages are decoded/encoded (7bit)
SMPP_USEGSMENCODING_INCHARSET -4 Incoming messages use GSM character set (8bit)
SMPP_USEGSMENCODING_OUTCHARSET -5 Outgoing messages use GSM character set (8bit)
SMPP_USEGSMENCODING_INOUTCHARS -6 In- and outgoing messages use GSM character set (8bit)

SMPP session state definitions

Constant Value Description
SMPP_SESSIONSTATE_DISCONNECTED 1 The session is disconnected
SMPP_SESSIONSTATE_CONNECTED 2 The session is connected to a client
SMPP_SESSIONSTATE_BINDING 3 The session has a bind request pending
SMPP_SESSIONSTATE_BOUND_TX 4 The session is connected and bound as transmitter
SMPP_SESSIONSTATE_BOUND_RX 5 The session is connected and bound as receiver
SMPP_SESSIONSTATE_BOUND_TRX 6 The session is connected and bound as transceiver

SMPP TLV definitions

Constant Value Description
SMPP_TLV_DEST_ADDR_SUBUNIT 0x0005 dest addr subunit (GSM)
SMPP_TLV_DEST_NETWORK_TYPE 0x0006 dest network type (Generic)
SMPP_TLV_DEST_BEARER_TYPE 0x0007 dest bearer type (Generic)
SMPP_TLV_DEST_TELEMATICS_ID 0x0008 dest telematics id (GSM)
SMPP_TLV_SOURCE_ADDR_SUBUNIT 0x000D source addr subunit (GSM)
SMPP_TLV_SOURCE_NETWORK_TYPE 0x000E source network type (Generic)
SMPP_TLV_SOURCE_BEARER_TYPE 0x000F source bearer type (Generic)
SMPP_TLV_SOURCE_TELEMATICS_ID 0x0010 source telematics id (GSM)
SMPP_TLV_QOS_TIME_TO_LIVE 0x0017 qos time to live (Generic)
SMPP_TLV_PAYLOAD_TYPE 0x0019 payload type (Generic)
SMPP_TLV_ADDITIONAL_STATUS_INFO_TEXT 0x001D additional status info text (Generic)
SMPP_TLV_RECEIPTED_MESSAGE_ID 0x001E receipted message id (Generic)
SMPP_TLV_MS_MSG_WAIT_FACILITIES 0x0030 ms msg wait facilities (GSM)
SMPP_TLV_PRIVACY_INDICATOR 0x0201 privacy indicator (CDMA, TDMA)
SMPP_TLV_SOURCE_SUBADDRESS 0x0202 source subaddress (CDMA, TDMA)
SMPP_TLV_DEST_SUBADDRESS 0x0203 dest subaddress (CDMA, TDMA)
SMPP_TLV_USER_MESSAGE_REFERENCE 0x0204 user message reference (Generic)
SMPP_TLV_USER_RESPONSE_CODE 0x0205 user response code (CDMA, TDMA)
SMPP_TLV_SOURCE_PORT 0x020A source port (Generic)
SMPP_TLV_DESTINATION_PORT 0x020B destination port (Generic)
SMPP_TLV_SAR_MSG_REF_NUM 0x020C sar msg ref num (Generic)
SMPP_TLV_LANGUAGE_INDICATOR 0x020D language indicator (CDMA, TDMA)
SMPP_TLV_SAR_TOTAL_SEGMENTS 0x020E sar total segments (Generic)
SMPP_TLV_SAR_SEGMENT_SEQNUM 0x020F sar segment seqnum (Generic)
SMPP_TLV_SC_INTERFACE_VERSION 0x0210 SC_interface version (Generic)
SMPP_TLV_CALLBACK_NUM_PRES_IND 0x0302 callback num pres ind (TDMA)
SMPP_TLV_CALLBACK_NUM_ATAG 0x0303 callback num atag (TDMA)
SMPP_TLV_NUMBER_OF_MESSAGES 0x0304 number of messages (CDMA)
SMPP_TLV_CALLBACK_NUM 0x0381 callback num (CDMA, TDMA, GSM, iDEN)
SMPP_TLV_DPF_RESULT 0x0420 dpf result (Generic)
SMPP_TLV_SET_DPF 0x0421 set dpf (Generic)
SMPP_TLV_MS_AVAILABILITY_STATUS 0x0422 ms availability status (Generic)
SMPP_TLV_NETWORK_ERROR_CODE 0x0423 network error code (Generic)
SMPP_TLV_MESSAGE_PAYLOAD 0x0424 message payload (Generic)
SMPP_TLV_DELIVERY_FAILURE_REASON 0x0425 delivery failure reason (Generic)
SMPP_TLV_MORE_MESSAGES_TO_SEND 0x0426 more messages to send (GSM)
SMPP_TLV_MESSAGE_STATE 0x0427 message state (Generic)
SMPP_TLV_USSD_SERVICE_OP 0x0501 ussd service op (GSM (USSD))
SMPP_TLV_DISPLAY_TIME 0x1201 display time (CDMA, TDMA)
SMPP_TLV_SMS_SIGNAL 0x1203 sms signal (TDMA)
SMPP_TLV_MS_VALIDITY 0x1204 ms validity (CDMA, TDMA)
SMPP_TLV_ALERT_ON_MESSAGE_DELIVERY 0x130C alert on message delivery (CDMA)
SMPP_TLV_ITS_REPLY_TYPE 0x1380 its reply type (CDMA)
SMPP_TLV_ITS_SESSION_INFO 0x1383 its session info (CDMA)

SMPP status code definitions

Constant Value Description
SMPP_ESME_ROK 0x00 No Error
SMPP_ESME_RINVMSGLEN 0x01 Message Length is invalid
SMPP_ESME_RINVCMDLEN 0x02 Command Length is invalid
SMPP_ESME_RINVCMDID 0x03 Invalid Command ID
SMPP_ESME_RINVBNDSTS 0x04 Incorrect BIND Status for given command
SMPP_ESME_RALYBND 0x05 ESME Already in Bound State
SMPP_ESME_RINVPRTFLG 0x06 Invalid Priority Flag
SMPP_ESME_RINVREGDLVFLG 0x07 Invalid Registered Delivery Flag
SMPP_ESME_RSYSERR 0x08 System Error
SMPP_ESME_RINVSRCADR 0x0A Invalid Source Address
SMPP_ESME_RINVDSTADR 0x0B Invalid Dest Addr
SMPP_ESME_RINVMSGID 0x0C Message ID is invalid
SMPP_ESME_RBINDFAIL 0x0D Bind Failed
SMPP_ESME_RINVPASWD 0x0E Invalid Password
SMPP_ESME_RINVSYSID 0x0F Invalid System ID
SMPP_ESME_RCANCELFAIL 0x11 Cancel SM Failed
SMPP_ESME_RREPLACEFAIL 0x13 Replace SM Failed
SMPP_ESME_RMSGQFUL 0x14 Message Queue Full
SMPP_ESME_RINVSERTYP 0x15 Invalid Service Type
SMPP_ESME_RINVNUMDESTS 0x33 Invalid number of destinations
SMPP_ESME_RINVDLNAME 0x34 Invalid Distribution List name
SMPP_ESME_RINVDESTFLAG 0x40 Destination flag is invalid (submit_multi)
SMPP_ESME_RINVSUBREP 0x42 Invalid 'submit with replace' request (i.e. submit_sm with replace_if_present_flag set)
SMPP_ESME_RINVESMCLASS 0x43 Invalid esm_class field data
SMPP_ESME_RCNTSUBDL 0x44 Cannot Submit to Distribution List
SMPP_ESME_RSUBMITFAIL 0x45 submit_sm or submit_multi failed
SMPP_ESME_RINVSRCTON 0x48 Invalid Source address TON
SMPP_ESME_RINVSRCNPI 0x49 Invalid Source address NPI
SMPP_ESME_RINVDSTTON 0x50 Invalid Destination address TON
SMPP_ESME_RINVDSTNPI 0x51 Invalid Destination address NPI
SMPP_ESME_RINVSYSTYP 0x53 Invalid system_type field
SMPP_ESME_RINVREPFLAG 0x54 Invalid replace_if_present flag
SMPP_ESME_RINVNUMMSGS 0x55 Invalid number of messages
SMPP_ESME_RTHROTTLED 0x58 Throttling error (ESME has exceeded allowed message limits)
SMPP_ESME_RINVSCHED 0x61 Invalid Scheduled Delivery Time
SMPP_ESME_RINVEXPIRY 0x62 Invalid message validity period (Expiry time)
SMPP_ESME_RINVDFTMSGID 0x63 Predefined Message Invalid or Not Found
SMPP_ESME_RX_T_APPN 0x64 ESME Receiver Temporary App Error Code
SMPP_ESME_RX_P_APPN 0x65 ESME Receiver Permanent App Error Code
SMPP_ESME_RX_R_APPN 0x66 ESME Receiver Reject Message Error Code
SMPP_ESME_RQUERYFAIL 0x67 query_sm request failed
SMPP_ESME_RINVOPTPARSTREAM 0xC0 Error in the optional part of the PDU Body.
SMPP_ESME_ROPTPARNOTALLWD 0xC1 Optional Parameter not allowed
SMPP_ESME_RINVPARLEN 0xC2 Invalid Parameter Length.
SMPP_ESME_RMISSINGOPTPARAM 0xC3 Expected Optional Parameter missing
SMPP_ESME_RINVOPTPARAMVAL 0xC4 Invalid Optional Parameter Value
SMPP_ESME_RDELIVERYFAILURE 0xFE Delivery Failure (used for data_sm_resp)
SMPP_ESME_RUNKNOWNERR 0xFE Unknown error

HTTP placeholder definitions

Constant Value Description
HTTP_PLACEHOLDER_USERTAG %USERTAG% Usertag
HTTP_PLACEHOLDER_TOADDRESS %TOADDRESS% To address
HTTP_PLACEHOLDER_FROMADDRESS %FROMADDRESS% From address
HTTP_PLACEHOLDER_BODY %BODY% Body
HTTP_PLACEHOLDER_BODYASHEX %BODYAXHEX% Body formatted as an hexadecimal string (e.g. '0a0b0c')
HTTP_PLACEHOLDER_BODYASBASE64 %BODYASBASE64% Body encoded in Base64
HTTP_PLACEHOLDER_DELIVERYREPORT %DELIVERYREPORT% 'true' or 'false' according to wether a delivery report was requested
HTTP_PLACEHOLDER_TOADDRESSTON %TOADDRESSTON% To address type of number
HTTP_PLACEHOLDER_TOADDRESSNPI %TOADDRESSNPI% To address numbering plan indicator
HTTP_PLACEHOLDER_FROMADDRESSTON %FROMADDRESSTON% From address type of number
HTTP_PLACEHOLDER_FROMADDRESSNPI %FROMADDRESSNPI% From address numbering plan indicator
HTTP_PLACEHOLDER_PROTOCOLID %PROTOCOLID% The protocol ID.
HTTP_PLACEHOLDER_UDHI %UDHI% 'true' or 'false' according to wether a user data header is present
HTTP_PLACEHOLDER_DATACODING %DATACODING% The datacoding for this SMS

Provider type definitions

Constant Value Description
DIALUP_PROVIDERTYPE_UCP 0 UCP protocol
DIALUP_PROVIDERTYPE_TAP_DEFAULT 1 TAP protocol
DIALUP_PROVIDERTYPE_TAP_NOLF 2 TAP protocol, no request for linefeed
DIALUP_PROVIDERTYPE_TAP_NOEOT 3 TAP protocol, no request for EOT

Device setting definitions

Constant Value Description
DIALUP_DEVICESETTINGS_DEFAULT 0 Default device settings
DIALUP_DEVICESETTINGS_8N1 1 No parity, 8 databits 1 stop bit
DIALUP_DEVICESETTINGS_7E1 2 Even parity, 7 databits 1 stop bit

Dialmode definitions

Constant Value Description
DIALUP_DIALMODE_TONE 0 Dialmode tone
DIALUP_DIALMODE_PULSE 1 Dialmode pulse

5.19. EMailConstants

In the Mobile Messaging Toolkit, all e-mail constants are grouped together in a separate object called EMailConstants. First create the constants object before you can actually use the constants:

Set objConstants = CreateObject( "AxMmToolkit.EMailConstants" )
...
WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_HIGHEST
WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_HIGH
WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_MEDIUM
WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_LOW
WScript.Echo objConstants.EMAIL_MESSAGE_PRIORITY_LOWEST
...

Priority definitions

Constant Value Description
EMAIL_MESSAGE_PRIORITY_HIGHEST Highest priority
EMAIL_MESSAGE_PRIORITY_HIGH High priority
EMAIL_MESSAGE_PRIORITY_MEDIUM Normal priority (default)
EMAIL_MESSAGE_PRIORITY_LOW Low priority
EMAIL_MESSAGE_PRIORITY_LOWEST Lowest priority

Encoding definitions

Constant Value Description
EMAIL_MESSAGE_ENCODING_DEFAULT Uses the Operating System's current codepage
EMAIL_MESSAGE_ENCODING_THAI ISO-8859-11 encoding
EMAIL_MESSAGE_ENCODING_JAPANESE ISO-2022-jp encoding
EMAIL_MESSAGE_ENCODING_CHINESE_SIMP GB2312 encoding
EMAIL_MESSAGE_ENCODING_KOREAN KSC-5601 encoding
EMAIL_MESSAGE_ENCODING_CHINESE_TRAD BIG5 encoding
EMAIL_MESSAGE_ENCODING_CENTRALEUROPE ISO-8859-2 encoding
EMAIL_MESSAGE_ENCODING_RUSSIAN ISO-8859-5 encoding
EMAIL_MESSAGE_ENCODING_WESTERN ISO-8859-1 encoding
EMAIL_MESSAGE_ENCODING_GREEK ISO-8859-7 encoding
EMAIL_MESSAGE_ENCODING_TURKISH ISO-8859-3 encoding
EMAIL_MESSAGE_ENCODING_HEBREW ISO-8859-8 encoding
EMAIL_MESSAGE_ENCODING_ARABIC ISO-8859-6 encoding
EMAIL_MESSAGE_ENCODING_BALTIC ISO-8859-4 encoding
EMAIL_MESSAGE_ENCODING_VIETNAMESE WINDOWS-1258 encoding
EMAIL_MESSAGE_ENCODING_UTF7 UTF-7 encoding
EMAIL_MESSAGE_ENCODING_UTF8 UTF-8 encoding

SMTP Authentication definitions

Constant Value Description
SMTP_AUTH_AUTO Auto detect (default)
SMTP_AUTH_PLAIN AUTH-PLAIN authentication
SMTP_AUTH_LOGIN AUTH-LOGIN authentication
SMTP_AUTH_MD5CRAM AUTH-CRAM-MD5 authentication

POP3 Authentication definitions

Constant Value Description
POP3_AUTH_AUTO Auto detect (default)
POP3_AUTH_PLAIN AUTH-PLAIN authentication
POP3_AUTH_APOP APOP authentication

5.20. Error Codes

When a function is called, the result of the function is stored in the object's 'LastError' property.
When 'LastError' is 0, it means that the last called function completed successfully; otherwise, an error occured.

The value of the LastError tells you why the function failed. All error codes are listed on the ActiveXperts web site:

www.activexperts.com/support/errorcodes (list of error codes).

Here, you can also lookup a specific error to find its description.

You can also call the 'GetErrorDescription' function of any of the objects to find the error description.

6. Error codes

6.1. Error codes

When a function is called, the result of the function is stored in the object's 'LastError' property. When 'LastError' is 0, it means that the last called function completed successfully; otherwise, an error occurred.

The value of the LastError tells you why the function failed. All error codes are listed on the ActiveXperts web site, here.

Alternatively, the 'GetErrorDescription' function can be used to find the error description for a given error code.

7. Support

7.1. API Samples

Samples for Visual Basic, Visual Basic .NET, Visual C++, Visual C# .NET, ASP and VBScript are included as part of the installation.

7.2. ActiveXperts support

Visit the ActiveXperts Support Site for a complete list of FAQ items at: http://www.activexperts.com/support

To contact support, please send an e-mail to: support@activexperts.com

8. Purchase and activation

8.1. Purchase

Please visit www.activexperts.com/sales to buy the product. Here, you can also find the latest prices. You can also contact us via email: sales@activexperts.com

8.2. Product Activation

After you purchase the product, you will receive a registration code. This code must be entered in the registry on your machine(s). There are three ways to accomplish this:

1. Automatic installation

The Mobile Messaging Toolkit automatic installation performs all necessary steps to install and register the component. It will ask for the registration code during installation and will enter the registration code in the registry.

2. 'Activate' function

The following objects have an 'Activate' function: AxMmToolkit.Gsm, AxMmToolkit.Smpp, AxMmToolkit.Http, AxMmToolkit.Snpp. This function can be used to activate the entire Mobile Messaging Toolkit.

  Set objGsm = CreateObject("AxMmToolkit.Gsm ")
objGsm.Activate XXXXX-XXXXX-XXXXX", True 'XXXXX-XXXXX-XXXXX' represents the registration code
                 ' Pass True to make the activation persistent, so you need to
                 ' call Activate only once. If you pass False, you need to call Activate
                 ' each time the product is started.

The Activate function of any of the objects writes the following entry to the registry, which will actually activate the product:

    Key: HKEY_LOCAL_MACHINE\Software\ActiveXperts\Mobile Messaging Toolkit\RegistrationKey  
      Type: REG_SZ  Value: XXXXX-XXXXX-XXXXX

where 'XXXXX-XXXXX-XXXXX' is the registration code issued to you.

3. Manually insert code in the registry

You can activate the product by editing the registry manually:

  • Start the registry editor (either REGEDT32.EXE or REGEDIT.EXE);
  • Open the 'HKEY_LOCAL_MACHINE\Software\ActiveXperts\Mobile Messaging Toolkit' key;
  • Add/modify the 'RegistrationKey' value: Type: REG_SZ, Value: XXXXX-XXXXX-XXXXX

Distribution License

For information about how to use the registration code with a Distribution License, please read the following document: How to distribute an ActiveXperts Toolkit.

Appendix A License Agreement

  PLEASE READ THIS SOFTWARE LICENSE AGREEMENT CAREFULLY BEFORE 
  DOWNLOADING OR USING THE SOFTWARE.  BY CLICKING ON THE 
  "ACCEPT" BUTTON, OPENING THE PACKAGE, DOWNLOADING THE PRODUCT, 
  OR USING THE EQUIPMENT THAT CONTAINS THIS PRODUCT, YOU ARE 
  CONSENTING TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE 
  TO ALL OF THE TERMS OF THIS AGREEMENT, CLICK THE "DO NOT 
  ACCEPT" BUTTON AND THE INSTALLATION PROCESS WILL NOT CONTINUE, 
  RETURN THE PRODUCT TO THE PLACE OF PURCHASE FOR A FULL REFUND, 
  OR DO NOT DOWNLOAD THE PRODUCT.
  
  GENERAL
  In this Software License Agreement:
  (i) "ActiveXperts" means ActiveXperts Software B.V.
  (ii) "Customer" means the individual(s), organization or business entity 
  buying a license of the Software from ActiveXperts or its Distributors 
  or its Resellers.
  (iii) "Software" means computer programs (and their storage medium) 
  supplied by ActiveXperts and known collectively as "Mobile Messaging Toolkit" 
  in which ActiveXperts has property rights and any user manuals, 
  operating instructions, brochures and all other documentation relating 
  to the said computer programs (the expression "Software" to include all 
  or any part or any combination of Software).
  
  1. LICENSE GRANT
  ActiveXperts grants Customer the following rights provided that you 
  comply with all terms and conditions of this License Agreement:
  
  (a) Installation and use. Customer may install, use, access, display and 
  run one copy of the Software on a single computer, such as a 
  workstation, terminal or other device ("Workstation Computer"). A 
  "License Pack" allows you to install, use, access, display and run 
  additional copies of the Software up to the number of "Licensed Copies" 
  specified above.
  
  (b) Reservation of Rights. ActiveXperts reserves all rights not 
  expressly granted to you in this License Agreement.
  
  2. UPGRADES AND SUPPLEMENTS
  To use a product identified as an upgrade, you must first be licensed 
  for the Software as eligible for the upgrade. After upgrading, Customer 
  may no longer use the product that formed the basis for Customer's 
  upgrade eligibility.
  
  This License Agreement applies to updates or supplements to the original 
  Software provided by ActiveXperts, unless we provide other terms along 
  with the update or supplement.
  
  3. LIMITATION ON REVERSE ENGINEERING,DECOMPILATION, AND DISASSEMBLY
  Customer may not reverse engineer, decompile, or disassemble the 
  Software, except and only to the extent that it is expressly permitted 
  by applicable law notwithstanding this limitation.
  
  4. TERMINATION
  Without prejudice to any other rights, ActiveXperts may cancel this 
  License Agreement if Customer does not abide by the terms and conditions 
  of this License Agreement, in which case you must destroy all copies of 
  the Software and all of its component parts.
  
  5. NOT FOR RESALE SOFTWARE
  Software identified as "Not for Resale" or "NFR," may not be resold, 
  transferred or used for any purpose other than demonstration, test or 
  evaluation.
  
  6. LIMITED WARRANTY
  ActiveXperts warrants that for a period of ninety (90) days from the 
  date of shipment from ActiveXperts: (i) the media on which the Software 
  is furnished will be free of defects in materials and workmanship under 
  normal use; and (ii) the Software substantially conforms to its 
  published specifications. Except for the foregoing, the Software is 
  provided AS IS. This limited warranty extends only to Customer as the 
  original licensee. Customer's exclusive remedy and the entire liability 
  of ActiveXperts and its suppliers under this limited warranty will be, 
  at ActiveXperts or its service center's option, repair, replacement, or 
  refund of the Software if reported (or, upon request, returned) to the 
  party supplying the Software to Customer. In no event does ActiveXperts 
  warrant that the Software is error free or that Customer will be able to 
  operate the Software without problems or interruptions.
  This warranty does not apply if the software (a) has been altered, 
  except by ActiveXperts, (b) has not been installed, operated, repaired, 
  or maintained in accordance with instructions supplied by ActiveXperts, 
  (c) has been subjected to abnormal physical or electrical stress, 
  misuse, negligence, or accident, or (d) is used in ultrahazardous 
  activities.
  
  
  7. LIMITATION OF LIABILITY AND REMEDIES.
  Notwithstanding any damages that you might incur for any reason 
  whatsoever (including, without limitation, all damages referenced above 
  and all direct or general damages), the entire liability of ActiveXperts 
  and any of its suppliers under any provision of this License Agreement 
  and your exclusive remedy for all of the foregoing (except for any 
  remedy of repair or replacement elected by ActiveXperts with respect to 
  any breach of the Limited Warranty) shall be limited to the greater of 
  the amount actually paid by you for the Software or U.S.$5.00. The 
  foregoing limitations, exclusions and disclaimers (including Sections 4, 
  5 and 6 above) shall apply to the maximum extent permitted by applicable 
  law, even if any remedy fails its essential purpose.
  
  8. ENTIRE AGREEMENT
  
  This License Agreement (including any addendum or amendment to this 
  License Agreements which is included with the Software) are the entire 
  agreement between you and ActiveXperts relating to the Software and the 
  support services (if any) and they supersede all prior or 
  contemporaneous oral or written communications, proposals and 
  representations with respect to the Software or any other subject matter 
  covered by this License Agreement. To the extent the terms of any 
  ActiveXperts policies or programs for support services conflict with the 
  terms of this License Agreement, the terms of this License Agreement 
  shall control.
  
  This Agreement shall be construed in accordance with the laws of The 
  Netherlands and the Dutch courts shall have sole jurisdiction in any 
  dispute relating to these conditions. If any part of these conditions 
  shall be or become invalid or unenforceable in any way and to any extent 
  by any existing or future rule of law, order, statute or regulation 
  applicable thereto, then the same shall to the extent of such invalidity 
  or enforceability be deemed to have been deleted from the conditions 
  which shall remain in full force and effect as regards all other 
  provisions.
  
  9. Copyright
  The Software is protected by copyright and other intellectual property 
  laws and treaties. ActiveXperts or its suppliers own the title, 
  copyright, and other intellectual property rights in the Software. The 
  Software is licensed, not sold.