Sending e-mail alert SMS messages with Ozeki NG SMS Gateway

In Ozeki NG SMS Gateway there is a feature to send alert SMS messages for e-mail recipients when they recieve e-mails. The following guide demonstrates how you can configure Ozeki NG SMS Gateway to use this feature.

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

Configuring the e-mail alert feature

The first step to allow Ozeki NG SMS Gateway to send alert SMS messages is to configure e-mail forwarding in the Edit/Server preferences menu, under the e-mail forwarding tab (Figure 1).

configuring e-mail forwarding in the edit or server preferences menu
Figure 1 - Configuring e-mail forwarding

You must check the Enable E-mail to SMS forwarding checkbox, to have the feature enabled. In the section below that you can configure the DNS hostname that points to the IP address of the actual SMS gateway, and the SMTP port of the built in SMTP server.

Under that section, you can check the Require SMTP authentication checkbox - by default, SMTP messages recieved by the SMTP server are passed through the admin user. If you require SMTP authentication, you can change this by requiring the user's username and password for which you want to pass the SMTP message - in this case, you will have to type in the username and password in the client you will use for sending SMTP messages.

You can also configure which part of the e-mail you want to forward. You can forward the e-mail subject and body, or only the subject or body. You can also limit the forwarded SMS messages' length - you can use greater numbers than 160, but note that in this case, sent messages will be split and sent in several parts - the client will reassamble the messages from those parts.

Configuring outbound routes

To have this feature working correctly, you must set up appropriate outgoing routes. Note, that we do not want to forward e-mail messages - we want to send alerts about recieving them.

You can read about outbound routing here: Outbound Routing

First, you need to add a route. You can choose the route name yourself. The source must be the user whose e-mails will be forwarded, and the destination must be the service provider you want to use for sending the SMS messages. In this case, we do not want to forward e-mail messages, we only need to send an alert message about recieving one. To do so, you need to fill in the keyword field too, with an appropriate regular expression (Figure 2).

an outgoing route for e-mail alerts
Figure 2 - An outgoing route for e-mail alerts

The above regular expression is:

s/^(.*)$/You just recieved a message!/

This will change the SMS message's text to "You just recieved a message!" - this message will be passed to the service provider. That is because the regular expression matches all kind of messages.

You can append the recieved e-mail's subject by using this regular expression:

s/^(.*)$/You just recieved a message with the subject: $1/

To have this second example working correctly, you must configure e-mail forwarding to forward the e-mails' subject only (see Figure 1 and description above).

You can read more about regular expressions under the following links:
Regular expressions
Message content modification during routing
Regular expressions with "AND" and "OR"

Testing the e-mail alert feature

If you configured everything according to the above guide, you can test the feature. I used Microsoft Outlook to send an e-mail about a forthcoming meeting (Figure 3).

sending an e-mail with microsoft outlook
Figure 3 - Sending an e-mail with Microsoft Outlook

My route is configured with the 2nd regex above (s/^(.*)$/You just recieved a message with the subject: $1/), so I want to send an e-mail alert SMS containing the e-mail subject. In the e-mail forwarding preferences, i configured Ozeki NG SMS Gateway to forward e-mail subjects only (see Figure 1 and description above). I use the 'SMPP0' service provider to send SMS alerts coming from my user, 'john' (Figure 4).

outgoing route configured with the appropriate regex
Figure 4 - Outgoing route configured with the appropriate regex

After sending the e-mail, if the service provider could send the alert SMS successfully, you will see the following in the service provider's log:

2022.02.01. 8:47:35 - INFO 3322: Sending message (try 1/1) john;SMS:TEXT;
   8676593d-de95-480d-9e5a-eecf1559d5e7;john;+36201234567;You just recieved a message with
   the subject: meeting;using service provider connection 'SMPP0(SMPP0)'
2022.02.01. 8:47:35 - INFO 3327: Message successfully sent. Reference: 1A8F164

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

More information