You are here:
ActiveXperts.com > SMS and MMS Toolkit > How to Use MMS Toolkit > SOAP (MM7) > ASP 2.x
Quicklinks
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:
MMS features:
Pager features:
This document describes how the SMS and MMS Toolkit can be integrated into ASP projects.
Download the SMS and MMS Toolkit from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.
First, create a new directory on the IIS Server's file system. This directory will hold the ASP later on.
From the 'Start menu', click on 'Administrative Tools' and click on 'Internet Information Services (IIS) Manager'. Right-click on the 'Web Sites' container and choose 'New->Web Site':
(Click on the picture to enlarge)
The 'Web Site Creation Wizard' is shown, guiding you thorugh the process of creating a new web site. Provide all necessary information:
You're now able to write an ASP script to send MMS content using the ActiveXperts SMS and MMS Toolkit.
Create a new ASP script called DEFAULT.ASP in the directory that was created in Step2, using your favorite editor. On top of the ASP code, insert the following lines to declare the MMS objects:
<% Dim objMmsConstants Dim objMm7Protocol Dim objMmsMessage Dim objMmsSlide %>
Insert the following lines to create the objects:
<% Set objMmsConstants = Server.CreateObject ( "ActiveXperts.MmsConstants" ) Set objMm7Protocol = Server.CreateObject ( "ActiveXperts.MmsProtocolMm7" ) Set objMmsMessage = Server.CreateObject ( "ActiveXperts.MmsMessage" ) Set objMmsSlide = Server.CreateObject ( "ActiveXperts.MmsSlide" ) %>
Now, test if your new web site is working well with the SMS and MMS Toolkit using your browser. If you are using Microsoft Internet Explorer, it is recommended to disable friendly error message because this default setting doesn't show any ASP error message, making it hard to debug if there are any problems:
Now, use the following piece of code in your DEFAULT.ASP page:
<%
Dim objMmsConstants
Dim objMm7Protocol
Dim objMmsMessage
Dim objMmsSlide
%>
<%
Set objMmsConstants = Server.CreateObject ( "ActiveXperts.MmsConstants" )
Set objMm7Protocol = Server.CreateObject ( "ActiveXperts.MmsProtocolMm7" )
Set objMmsMessage = Server.CreateObject ( "ActiveXperts.MmsMessage" )
Set objMmsSlide = Server.CreateObject ( "ActiveXperts.MmsSlide" )
%>
<html>
<head>
<title>MMS Toolkit Demo</title>
</head>
<body>
MMS Toolkit version: <% = objMm7Protocol.Version %><br>
MMS Toolkit expiration date: <% = objMm7Protocol.ExpirationDate %><br>
</body>
</html>
And test it with your favorite browser. The result should be like this:
(Click on the picture to enlarge)
You can now send MMS messages using a SOAP compliant MMS provider.
The following ASP code generates a website where the user can choose a GIF image, and send it as a MMS message to his mobile phone or email address.
The demo can be run from a client connecting to the ASP webserver. The client does not need any additional hardware.
The following ASP code shows how to send a MMS:
<%@ CodePage=65001%>
<% Option Explicit %>
<object runat="server" progid="ActiveXperts.MmsProtocolMm7" id="objMm7Protocol"> </object>
<object runat="server" progid="ActiveXperts.MmsMessage" id="objMessage"> </object>
<object runat="server" progid="ActiveXperts.MmsSlide" id="objSlide"> </object>
<object runat="server" progid="ActiveXperts.MmsConstants" id="objConstants"> </object>
<html>
<head>
<title>MMS via MM7 - ASP Sample</title>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<style>
.clbody {
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:9pt;
font-weight:normal;
}
.clfooter {
font-family:Verdana;
font-size:7pt;
font-weight:normal;
}
h1, .h1 {
width:100%;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:18px;
font-weight:bold;
}
hr, .hr {
color:#b0b0b0;
}
</style>
</head>
<body class="clbody">
<h1>MMS via MM7 - ASP Sample</h1>
<div style="WIDTH:700px">
MM7 requires connectivity to an MMSC through the internet/VPN. Select an MM7 provider first (MM7 config files are shipped with the product). The protocol is based on SOAP, using HTTP as the transport protocol. The encoding of the messages is done with XML.<br>
For more details about using SMS and MMS Toolkit with ASP, <a target="_blank" href="http://www.activexperts.com/support/xmstoolkit#asp">
click here</a>.<br>
</div>
<hr size="1">
<%
Dim numLastError, strLastError, strReply
numLastError = 0
strLastError = ""
strReply = ""
If( Request( "CTL_SEND" ) <> "" ) Then
objSlide.Clear()
objSlide.AddText( Request( "CTL_MESSAGE" ) )
objSlide.AddAttachment Request( "CTL_ATTACHMENT" ) , 0
objMessage.Clear()
objMessage.AddRecipient Request( "CTL_RECIPIENT" ), objConstants.asMMS_RECIPIENT_TO
objMessage.From = Request( "CTL_SENDER" )
objMessage.Subject = Request( "CTL_SUBJECT" )
objMessage.AddSlide(objSlide)
objMm7Protocol.Clear()
objMm7Protocol.ProviderURL = Request( "CTL_URL" )
objMm7Protocol.ProviderAccount = Request( "CTL_ACCOUNT" )
objMm7Protocol.ProviderPassword = Request( "CTL_PASSWORD" )
If( Request ( "CTL_SSL" ) <> "" ) Then
objMm7Protocol.ProviderUseSSL = True
End If
' objMm7Protocol.LogFile = "c:\mmsmm4.log"
objMm7Protocol.Send( objMessage )
numLastError = objMm7Protocol.LastError
strLastError = objMm7Protocol.GetErrorDescription( numLastError )
End If
%>
<form action="default.asp" method="post">
<table class ="clbody" width="700">
<tr>
<td valign="top">URL:</td>
<td align="left" valign="top"><input style="width: 200px" type="text" name="CTL_URL" value=<% If Request( "CTL_URL" ) = "" Then %>"[URL]"<% Else %><% = Request( "CTL_URL" ) %><% End If %>>
<% If( Request( "CTL_SSL" ) <> "" ) Then %>
<input style="width: 50px" type="checkbox" name="CTL_SSL" value="uni" checked>SSL
<% Else %>
<input style="width: 50px" type="checkbox" name="CTL_SSL" value="uni">SSL
<% End If %>
</td>
</tr>
<tr>
<td valign="top">Account:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_ACCOUNT" value=<% If Request( "CTL_ACCOUNT" ) = "" Then %>""<% Else %><% = Request( "CTL_ACCOUNT" ) %><% End If %>>
</tr>
<tr>
<td valign="top">Password:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_PASSWORD" value=<% If Request( "CTL_PASSWORD" ) = "" Then %>""<% Else %><% = Request( "CTL_PASSWORD" ) %><% End If %>>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">Recipient:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_RECIPIENT" value=<% If Request( "CTL_RECIPIENT" ) = "" Then %>"[Recipient]"<% Else %><% = Request( "CTL_RECIPIENT" ) %><% End If %>> <a target="_blank" href="http://www.activexperts.com/support/xmstoolkit?kb=Q5200015#Q5200015">Recipient number format</a></td>
</tr>
<tr>
<td valign="top">Sender:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_SENDER" value=<% If Request( "CTL_SENDER" ) = "" Then %>""<% Else %><% = Request( "CTL_SENDER" ) %><% End If %>>
</tr>
<tr>
<td valign="top">Subject:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_SUBJECT" value=<% If Request( "CTL_SUBJECT" ) = "" Then %>""<% Else %><% = Request( "CTL_SUBJECT" ) %><% End If %>>
</tr>
<tr>
<td valign="top">Message:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_MESSAGE" value=<% If Request( "CTL_MESSAGE" ) = "" Then %>"[Message]"<% Else %><% = Request( "CTL_MESSAGE" ) %><% End If %>></td>
</tr>
<tr>
<td valign="top">Attachment:</td>
<td valign="top"><input style="width: 250px" type="text" name="CTL_ATTACHMENT" value=<% If Request( "CTL_ATTACHMENT" ) = "" Then %>"C:\Windows\System32\Setup.bmp"<% Else %><% = Request( "CTL_ATTACHMENT" ) %><% End If %>>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"><input size="25" type="submit" value="Send" name="CTL_SEND" style="height: 23px; width: 250px"></td>
</tr>
<tr>
<td valign="top"> </td>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top">Result:</td>
<td valign="top"><% = numLastError %>: <% = strLastError %></td>
</tr>
</table>
<br>
<br>
</form>
<hr size="1">
<div class="clfooter">
This demo uses the ActiveXperts SMS and MMS Toolkit, an <a target="_blank" href="http://www.activexperts.com">ActiveXperts Software</a> product.<br>
<a href="..">Click here</a> to return to the ASP sample menu page.<br>
</div>
</body>
</html>
You can find the sample images used in this sample below:
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.