SendSMS Method

Description:

The SendSMS method sends out a text message. The destination mobile number and the text message are specified as parameters of the method. The optional parameter AlertMessage specifies if the message should be displayed immediately on the recipients mobile phone (Flash Message).

   

Usage strResult = SendSMS(DestinationNumber, TextMessage, [AlertMessage])
Parameters
  • DestinationNumber As String - Mobile phone number of the intended recipient.
  • TextMessage As String - The text message to be sent
  • AlertMessage As Boolean - If set to True then the message is displayed immediately on recipients mobile phone (Also known as Flash Message).
Returns
  • String value indicating the message reference number
  • If the text message is longer than the maximum permissible size then it is sent as per LongMessage property settings. If LongMessage property is 1, 2 or 3 then multiple messages are sent and the message references of all the messages are returned separated by comma (,).
Remarks DestinationNumber can be:
  • International format i.e. with '+<Country Code>' as prefix (e.g. +919873094767)
  • National format, without country code prefix (e.g. 9873094767)

Usage Example:

Visual Basic / ASP (VBScript)
Dim objSMS As mCore.SMS, strMyMessage As String
Set objSMS = New mCore.SMS
' You can also use Set objSMS = CreateObject("mCore.SMS")
' In case of ASP (VBScript) to create object use
' Set objSMS = Server.CreateObject("mCore.SMS")
' In ASP use Response.Write instead of MsgBox
If objSMS.LogSize > 100 Then
     ClearLog(10)
End If
objSMS.LogType = 2
objSMS.Port = "COM3"
objSMS.BaudRate = 19200
' It is not necessary to execute the 'Connect' method.
' Connection state is detected internally by mCore and
' the 'Connect' method is executed accordingly.
objSMS.Character = 0
strMyMessage = "This is a test message"
objSMS.SendSMS "+919873094767", strMyMessage
' To send the above as alert message use the following line:
' objSMS.SendSMS("+919873094767", strMyMessage, True)
If Not objSMS.IsError(True) Then
     MsgBox "Message Sent!"
End If
' Disconnect method is executed internally
' whenever the SMS object is terminated.
Set objSMS = Nothing

  

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved