Mobilchange news Documentation Contents User Documentation Administrator Documentation Index of terms Technical Support On-line Search

Programatic SMS sending from applications

This document describes how to send a SMS from common application. From the reader is expected some basic programming knowledge and skills with COM objects in Win32 environment.

Document content


Intro

If you need to send SMS from a common application, the SendSMS object is here ready for you. It can be used at any computer where MobilChange server has rights to access. It is written for Windows NT 4.0/200x but it should be working on Windows 9x either.

back to top of page


SendSMS object installation and configuration

Copy the file SendSMS.dll from the Program Files/Common Files/Datasys/ directory to the computer, where you will use the object.

Register it using regsvr32 sendsms.dll.

Verify, that you have access rights (create, rename and delete files) for the MxInQueue share on the MobilChange server.

Installation is completed by finishing this step.

back to top of page


SendSMS object creation and usage

Object is named SendSMS.SendSMSObj. Create it using your preferred language resources, ex. VBScript:
 
Dim SendSMS
Set SendSMS = CreateObject( "SendSMS.SendSMSObj" )
 

back to top of page


SendSMS.Init() function

SendSMS.Init() function initializes the SendSMS object. It is not possible to send SMS before calling this function. This function should be called only once at the beginning of your work. Syntax is:

SendSMS.Init( appname, [server] )
appname (text string) The name of sending application. Can contain only normal (not capitals) characters of English alphabet and numbers.
server (text string) MobilChange server name. If empty string is given, local computer will be used.
(returned
value)
Text string "OK" = successful initialization, "ERROR" = problem during initialization

Sample of usage:
 
Dim rc
rc = SendSMS.Init( "banking1", "server15" )
If rc <> "OK" Then
    ' error must be processed here
End If
 

back to top of page


SendSMS.SendSMS() function

SendSMS.SendSMS() function sends the SMS message. Syntax is:

SendSMS.SendSMS( To, Text, [NoModify=False], [FromName], [FromEmail], [FromSmtp], [Language], [DR=False] )

If some of FromName, FromEmail or FromSmtp parameters is not entered, "$Aappname" value will be used automatically, where appname is parameter used during object initialization. So in the example bellow will be used $Abanking1.
To (text string) The phone number of recipient.
Text (text string) Text of message.
NoModify (True/False) If value is True, the text of message is being sent in exact form as entered by application. If it is False, the text is processed via MobilChange server in the same way as sent e-mails, i.e. the spaces are skipped, decoded czech etc.
FromName (text string) User name used by application when sending SMS. If used you must enter also FromEmail.
The delivery report will be sent to this name.
FromEmail (text string) E-mail address of the user used by application when sending SMS, but only in the range of local e-mail system (i.e. EX: address on Exchange server). Required if DR=True.
The delivery report will be sent to this address.
FromSMTP (text string) SMTP address of the user used by application when sending SMS.
This address is used for formating an outgoing SMS (if NoModify=False).
Language (text string) Language code of the user used by application when sending SMS.
You can use the same codes, as used in MobilChange - names of subdirectories in MobilChange/data/ directory, ie. CZ, UK, GE...
DR (True/False) If it is True, the delivery report is required. If it is False, the delivery report is not required.
(returned
value)
Text string "OK", when everything is alright,
string "ERROR" in the case of error.

Sample of usage:
 
Dim rc
rc = SendSMS.SendSMS( "+420603899285", "Hello, World!", True )
If rc <> "OK" Then
    ' error must be processed here
End If
 

back to top of page


SendSMS.UnInit() method

SendSMS.UnInit() method uninitializes SendSMS object. It is not possible to send SMS messages after calling the method. This method should be called only once at the end of your work. Syntax is:

SendSMS.UnInit()

Sample of usage:
 
Call SendSMS.UnInit()
 

back to top of page


SendSMS.LastError Property

SendSMS.LastError property contains text description of the last error generated in SendSMS object.

back to top of page