ℹ️ The Auron SMS Server is now Auron Omni. Learn more here.

How can we help?

AxMmServer.Message


In C#, VB.Net, C++ and other compiled languages the namespace for most classes is AXMMCFGLib instead of AxMmServer. For interpreted languages like VBScript, JavaScript or Powershell it is AxMmServer.

Property Type Read/Write Description
ID Number Read ID of the message
DirectionID String Read/Write Message direction. Incoming or outgoing
TypeID String Read Message Type
StatusID String Read/Write Status of a message
TriggerStatusID String Read/Write Trigger status
AckStatusID String Read/Write Acknowledge status
ChannelID String Read/Write Channel ID of the channel that sent or received the message
BillingID String Read/Write Billing ID used for accounting
ScheduledTime DateTime Read/Write When to send the message
SentTime DateTime Read/Write When the message was sent
ReceivedTime DateTime Read/Write When the message was received
LastUpdate DateTime Read/Write When the message record was last updated
Priority Number Read/Write The message priority
BatchID Number Read/Write User field
ConversationID Number Read/Write User field
Hash String Read/Write The hash of a message
Creator String Read/Write The creator of the message
Archive Boolean Read/Write System field
Trace String Read/Write A trace of the current message
CustomField1 Number Read/Write User field
CustomField2 String Read/Write User field
LastError Number Read/Write Completion code of the last called function

Method Description
AddTrace Adds a trace line to the Trace property
CountAttachments Count the number of attachments to this message
GetAttachmentName Get the name of the given attachment index
GetAttachmentSize Get the size of the given attachment index
AddAttachment Add an attachment to this message
SaveAttachment Save an attachment to file

ID property

ID of the message. It is the unique record ID in the Messages database.

DirectionID property

Direction of the message. Click here to see a list of valid DirectionID values.

TypeID property

Type of the message. This is either SMS, EMAIL, FILE or SMPPSERVERBIND.

StatusID property

Status of the message. Click here to see a list of valid StatusID values.

TriggerStatusID property

Trigger status of the message. Click here to see a list of valid TriggerStatusID values.

AckStatusID property

Acknowledge status of the message. Click here to see a list of valid AckStatusID values.

ChannelID property

The channel ID of the channel that sent or received the message. Set a channel ID when inserting a message to bypass the routing stage and force the message to be sent on the given channel.

BillingID property

The Billing ID is used by the SMPP Server channel to store the SystemID that sent a message.

ScheduledTime property

A message will be sent out automatically by Auron Omni when the current time is equal to or greater than the scheduled time.

SentTime property

The sent time records when the message was originally sent out by Auron Omni.

ReceivedTime property

The received time records when the message was originally received by Auron Omni.

LastUpdate property

The field always represents the time when the message record was last updated.

Priority property

The message priority. A higher number means higher priority. This number affects the order in which messages are processed. Note that a higher priority message cannot jump in front of a queue of messages that is currently being processed.

BatchID property

This field can be used to uniquely identify all messages in a specific batch. This can be used for bulk sending.

ConversationID property

This field can be used to keep track of strongly related messages. For instance, to connect a delivery report to the original message or to keep messages in a request/response chain associated with each other.

Hash property

This field is used by GSM and POP3 channels to keep an SHA1 hash of the message. The hash is used to recognize if a message was already processed on a previous occasion.

Creator property

This field contains the identifier of the original creator of the message. When a message is received by a channel, the channel ID will be stored here.

Archive property

This is a system field. The archiver thread in Auron Omni uses this field to claim messages for archiving.

Trace property

The message trace is a log of every significant event that has happened to this message. This is a multiline field where each line contains a datetime and a trace string.

CustomField1 property

Custom number field. You can use this field to attach data related to your own business logic to a message.

CustomField2 property

Custom string field. You can use this field to attach data related to your own business logic to a message.

LastError property

The last error code. This property is used in combination with any of the methods in this class.

AddTrace method

Adds a trace line to the Trace property. You do not need to add date and time. The AddTrace function does this automatically.

Parameters:

The string that needs to be traced.

Return value:

None

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Set objMessage   = objMessageDB.FindFirstMessage( "", "" )     ' Find first message
WScript.Echo "FindFirstMessage, result: " &  objMessageDB.LastError    
If( objMessageDB.LastError <> 0 ) Then
  objMessageDB.Close
  WScript.Quit
End If  

WScript.Echo "Trace: " & objMessage.Trace

objMessage.AddTrace( "Hello, world" )

WScript.Echo vbCrLf
WScript.Echo "Trace: " & objMessage.Trace

objMessageDB.Save( objMessage )                            ' Save the modified message
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");

var objMessage = objMessageDB.FindFirstMessage("", "");
WScript.Echo("FindFirstMessage, result: " + objMessageDB.LastError);
if (objMessageDB.LastError !== 0) {
  objMessageDB.Close();
  WScript.Quit();
}

WScript.Echo("Trace: " + objMessage.Trace);

objMessage.AddTrace("Hello, world");

WScript.Echo("\r\n");
WScript.Echo("Trace: " + objMessage.Trace);

objMessageDB.Save(objMessage);

CountAttachments method

Counts the number of attachments to this message. Only messages of type EMAIL can have attachments.

Parameters:

None

Return value:

Number of attachments

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Set objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL)
objMessage.AddAttachment("G:\MmServer\test\Test.pdf")
WScript.Echo "Add Attachment Result: " & objMessage.LastError

Dim n, i
n = objMessage.CountAttachments
For i = 0 To n - 1
  objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");

var objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL);
objMessage.AddAttachment("G:\\MmServer\\test\\Test.pdf");
WScript.Echo("Add Attachment Result: " + objMessage.LastError);

var n, i;
n = objMessage.CountAttachments;
for (i = 0; i < n; i++) {
  objMessage.SaveAttachment(i, "G:\\MmServer\\test\\Test2.pdf");
}

GetAttachmentName method

Gets the name of the given attachment index. This is usually the filename.

Parameters:

Attachment index

Return value:

Name of attachment

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

' ...
 
Dim n, i
n = objMessage.CountAttachments
For i = 0 To n - 1
  WScript.Echo objMessage.GetAttachmentName(i)
  WScript.Echo objMessage.GetAttachmentSize(i)
  objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");

// ...

var n, i;
n = objMessage.CountAttachments;
for (i = 0; i < n; i++) {
  WScript.Echo(objMessage.GetAttachmentName(i));
  WScript.Echo(objMessage.GetAttachmentSize(i));
  objMessage.SaveAttachment(i, "G:\\MmServer\\test\\Test2.pdf");
}

GetAttachmentSize method

Gets the size of the given attachment index.

Parameters:

Attachment index

Return value:

Size of attachment

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

' ...
 
Dim n, i
n = objMessage.CountAttachments
For i = 0 To n - 1
  WScript.Echo objMessage.GetAttachmentName(i)
  WScript.Echo objMessage.GetAttachmentSize(i)
  objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next

var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");

// ...

var n, i;
n = objMessage.CountAttachments;
for (i = 0; i < n; i++) {
  WScript.Echo(objMessage.GetAttachmentName(i));
  WScript.Echo(objMessage.GetAttachmentSize(i));
  objMessage.SaveAttachment(i, "G:\\MmServer\\test\\Test2.pdf");
}

AddAttachment method

Adds an attachment to this message. The attachment is loaded from file and kept in memory until the message is saved.

Parameters:

Filepath

Return value:

None

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Set objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL)
objMessage.AddAttachment("G:\MmServer\test\Test.pdf")
WScript.Echo "Add Attachment Result: " & objMessage.LastError

Dim n, i
n = objMessage.CountAttachments
For i = 0 To n - 1
  objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");

var objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL);
objMessage.AddAttachment("G:\\MmServer\\test\\Test.pdf");
WScript.Echo("Add Attachment Result: " + objMessage.LastError);

var n, i;
n = objMessage.CountAttachments;
for (i = 0; i < n; i++) {
  objMessage.SaveAttachment(i, "G:\\MmServer\\test\\Test2.pdf");
}

SaveAttachment method

Saves an attachment to file.

Parameters:

Index

Filepath

Return value:

None

Example:

Set objMessageDB = CreateObject( "AxMmServer.MessageDB" ) 
Set objConstants = CreateObject( "AxMmServer.Constants" ) 

Set objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL)
objMessage.AddAttachment("G:\MmServer\test\Test.pdf")
WScript.Echo "Add Attachment Result: " & objMessage.LastError

Dim n, i
n = objMessage.CountAttachments
For i = 0 To n - 1
  objMessage.SaveAttachment i, "G:\MmServer\test\Test2.pdf"
Next
var objMessageDB = new ActiveXObject("AxMmServer.MessageDB");
var objConstants = new ActiveXObject("AxMmServer.Constants");

var objMessage = objMessageDB.Create(objConstants.MESSAGETYPE_EMAIL);
objMessage.AddAttachment("G:\\MmServer\\test\\Test.pdf");
WScript.Echo("Add Attachment Result: " + objMessage.LastError);

var n, i;
n = objMessage.CountAttachments;
for (i = 0; i < n; i++) {
  objMessage.SaveAttachment(i, "G:\\MmServer\\test\\Test2.pdf");
}