Using optional SMTP header fields in SMTP messages

In Ozeki NG SMS Gateway there is an option to operate with an optional parameter passed via an SMTP message. This guide gives information about how to use optional header field values SMTP messages - note that this feature is only available in Ozeki NG SMS Gateway 4.2.5 or above.

You can read about Ozeki NG SMS Gateway's Email to SMS feature here: Email to SMS feature in Ozeki NG SMS Gateway

While sending SMTP messages, you can include optional parameters in the SMTP messages' headers.

If you have enabled SQL reporting in the servers preferences, you can track this value (Figure 1).

enabling sql reporting
Figure 1 - Enabling SQL reporting

You need to have an appropriate field in the table containing the messages of the outbox. This field will be containing the optional parameter value you pass. Note, that the first five fields order (username, msgtype, msgid, sender, reciever) cannot be changed.

While editing the SQL script in the Accepted for delivery section, you can use the $optional_parametername_ keyword to let Ozeki NG SMS Gateway save your messages' optional parameters. Note, that the parameter name in the keyword must contain only alphanumeric characters except for the underline ("_") character.

Have a look at the example below.

First, you need to create the database table with the below script so it can contain the parameter's value.

CREATE TABLE IF NOT EXISTS 'outbox' (
   'id' int(11) NOT NULL AUTO_INCREMENT,
   'username' varchar(30),
   'msgtype' varchar(160),
   'msgid' varchar(60),
   'callbackid' varchar(255) ,
   'sender' varchar(30) ,
   'receiver' varchar(30),
   'msgsubject' varchar(1024) ,
   'msgdata' text ,
   'acceptedfordeliverytime' datetime ,
   'deliveredtonetworktime' datetime ,
   'deliveredtohandsettime' datetime,
   'operator' varchar(30),
   'route' varchar(30),
   'status' varchar(130),
   'errormessage' varchar(1024),
   'cost' varchar(10),
   'test' int(11),
   PRIMARY KEY ('id')
)

Notice that we added the test field which will contain the optional parameter's value.

After that, in the Server preferences menu you need to change the SQL script under the Databases panel and Accepted for delivery tab. You need to write in the additional field name and the appropriate keyword ($optional_test_ now) into the INSERT statement (Figure 2).

sql script for optional parameters
Figure 2 - SQL script for optional parameter

Then, you can send an SMTP message with a "test" parameter via telnet. The value for this parameter is 43 (Figure 3).

the smtp message was sent with test parameter
Figure 3 - SMTP message sent with "test" parameter

The database will update the corresponding record's test field with the passed value (43 now).

This feature can be used to track emails by sending a dynamically set parameter in SMTP messages.

For more information please contact us at info@ozekisms.com.

More information