Shortcut Menu

Skip

Main Navigation

Choose your language


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

Using The MMS Toolkit with Powershell (MM7 Connection)

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

SMS features:

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

MMS features:

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

Pager features:

  • Send alpha-numeric Pager messages through SNPP

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

Step 1: Download and install The MMS Toolkit

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

Step 2: Create a new script

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

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

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

Create a new Powershell file called DEMO.PS1.

Create the MMS objects like this:

$objConnection                 	= new-object -comobject ActiveXperts.MmsProtocolMm7
$objMessage                    	= new-object -comobject ActiveXperts.MmsMessage
$objSlide                      	= new-object -comobject ActiveXperts.MmsSlide
$objConstants                  	= new-object -comobject ActiveXperts.MmsConstants

Step 4: Send MMS messages

You can now send MMS messages.

The following Powershell code shows how to send a MMS message using a SOAP (MM7) connection:

#################################################################################
# ActiveXperts SMS and MMS Toolkit - Powershell script
#  Copyright ActiveXperts Software B.V.
#
# For more information about ActiveXperts SMS and MMS Toolkit, please
# visit the online ActiveXperts SMS and MMS Toolkit page at:
# http://www.activexperts.com
#################################################################################
# Send an MMS message through a SOAP/HTML MMS Provider (MM7 Protocol )
#################################################################################

cls

#################################################################################
# Functions --------------------------------------------------------------------#
#################################################################################


#################################################################################
# ReadInput --------------------------------------------------------------------#

function ReadInput($strTitle, $strDefault, $bAllowEmpty)
{
	$strReturn = ""
	do
		{
		     $strInput = Read-host($strTitle, " - Enter value (e.g.:", $strDefault, ")")
		     if($strInput -ne "") 
				{
		          $strReturn = $strInput
				}
			
			if($bAllowEmpty -eq 1)
				{
					break
				}
		}		
	while($strReturn -eq "")

	return $strReturn
}

#################################################################################
# THE SCRIPT ITSELF ------------------------------------------------------------#
#################################################################################

# Create $objects
$objConnection                 	= new-object -comobject ActiveXperts.MmsProtocolMm7
$objMessage                    	= new-object -comobject ActiveXperts.MmsMessage
$objSlide                      	= new-object -comobject ActiveXperts.MmsSlide
$objConstants                  	= new-object -comobject ActiveXperts.MmsConstants

# Mmslide: Add duration, attachments(s) and text(s)
$objSlide.Clear()
#Display this screen for 10 seconds
$objSlide.Duration                 	= 10          
$objSlide.AddAttachment("logo.gif")
$objSlide.AddText("The ActiveXperts logo")

# Set Subject
$objMessage.Subject                	= "MMS Message"

# Set Recipient
$tecipient = ReadInput "Enter recipient address" "+" 0
$objMessage.AddRecipient($recipient, $objConstants.asMMS_RECIPIENT_TO)

# Set Message Class
$objMessage.Class                  	= $objConstants.asMMS_CLASS_PERSONAL 

# Set Message Priority
$objMessage.Priority               	= $objConstants.asMMS_PRIORITY_HIGH

# MmsMessage: Add the slide created above. Note:You can add multiple slides
$objMessage.AddSlide($objSlide)

# Connection: Set Provider
$objConnection.ProviderURL         	= "http://dell04/mm7"

$objConnection.ProviderWebAccount	= "mm7"
$objConnection.ProviderWebPassword	= "mm7"

# Connection: Set MM7 variation  3GPP / Ericsson / PAP
$objConnection.ProviderMM7Variation	= $objConstants.asMMS_MM7VARIATION_3GPP

# Connection, optional, VASID and VASPID
$objConnection.ProviderVASID		= "MMS"
$objConnection.ProviderVASPID		= "ActiveXperts" 

# Connection: Set log file
$objConnection.LogFile				= "mmslog.txt"

# Connection: send now
$objConnection.Send($objMessage)

Write-Host "Send, result: " $objConnection.LastError " (" $objConnection.GetErrorDescription($objConnection.LastError) ")`n"
Write-Host "Provider response: " $objConnection.ProviderRespons "`n MessageID: " $objConnection.MessageId

# MM1Connection: ready
Write-Host "Ready."
Start-Sleep -m 3000

To run the code, start Powershell and browse to the location of the file you just created. Enter .\Demo.ps1 to run the code. Notice that if the script is not working, you have to change the execution policy; you can do that with the following command:

Set-ExecutionPolicy -unrestricted

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