Send and receive using the database
An easy way to send out SMS or E-mail messages using the SMS Server is through creating new records directly into the database.
This is often very useful, especially when your script or application runs on a different PC or maybe even on a Linux or Unix type system. In these cases it’s almost always a possibility to connect directly to the SMS Server database using an ODBC driver.
To send out an SMS message simply run this query:
INSERT INTO InsertSms (StatusID, ToAddress, Body) VALUES ('SCHEDULED', '+3112345678', 'Hello, World')
This will send out an SMS message to +3112345678 to the first outgoing SMS channel available.
To send the SMS to a specific channel use:
INSERT INTO InsertSms (StatusID, ChannelID, ToAddress, Body) VALUES ('SCHEDULED', 'GSMCHANNEL1', '+3112345678', 'Hello, World')
This will send out the same SMS message to ‘GSMCHANNEL1’.
All of the fields in the InsertSMS view are documented here.
Of course this view can also be used to view incoming messages by selected on the StatusID field.
SELECT * FROM InsertSms WHERE StatusID = 'RECEIVED'
Will show all received messages.
The same paradigm can be applied to sending out e-mail messages with a single line SQL statement:
INSERT INTO InsertEmail (StatusID, ToAddress, BodyPlainText) VALUES ('SCHEDULED', 'email@example.com', 'Alert!')
All of the fields in the InsertEmail view are documented here.
All of the ‘Insert’ tables with all of their properties are documented in the Database Layout section of the knowledge base.