How can we help?

Forward E-mail to SMS


A common use case for the SMS Server is to forward E-mail message to SMS.

SMS notifications have the advantage that most mobile phones will buzz on a new SMS but not on a new E-mail.

If you want to forward an e-mail to multiple recipients please have a loot at this How-To as well.

To follow this example please first download and install the SMS Server.

This example will walk through the configuration of the following items:

  • An E-mail channel to receive e-mail.
  • An SMS channel to send SMS
  • A forwarding trigger to forward e-mail to SMS

You can find out more about channels in this knowledge base article.  Find more about triggers here.

Setting up an E-mail channel

To receive e-mails in the SMS Server you will need either an IMAP channel or a POP3 channel. IMAP is generally the easiest to setup.

In this example we’ll use IMAP to connect to a GMail account.

Start creating an IMAP channel by following these steps:

  1. Open the SMS Server manager application
  2. Click open the ‘Configuration’ section in the tree view on the left
  3. Click on the ‘New Channel’ link in the view on the right
  4. Select ‘IMAP Receive E-mail’ from the list of available channel types
  5. Click on ‘Create’
Create a new IMAP Channel

Create a new IMAP Channel

Clicking create will start the IMAP channel wizard. Follow this wizard to setup your IMAP settings. If you are in doubt about which Mailbox to select please select ‘INBOX’. This is the default IMAP mailbox that will contain all incoming messages.

Edit IMAP channel

Edit IMAP channel

Setting up an SMS Channel

To send SMS messages we need an SMS channel. This can be either GSM, SMPP or HTTP channel.

For most small application GSM will probably make the most sense. To be able to send through GSM you will need a GSM modem. This is a device that takes a SIM card and is connected to your PC through USB.

Another common way to send SMS messages is by using HTTP. This is often more convenient than a GSM modem because no GSM device or SIM card is needed. With HTTP you can easily send SMS messages through the internet.

In this case we’ll use SMPP. This is like HTTP in that it connects to a provider through the internet. SMPP is common in very high performance / reliability applications. In this example it’s convenient because we can make use of the free Auron test and demonstration gateway.

Start creating an SMPP channel in the SMS Server manager by following these steps:

  1. Click open the ‘Configuration’ section in the tree view on the left
  2. Click on the ‘New Channel’ link in the view on the right
  3. Select ‘SMPP Client’ from the list of available channel types
  4. Click on ‘Create’

The settings to connect to the test and demonstration gateway are already the default settings. You can just click on ‘Next’ and finally ‘Finished’ to complete this channel.

SMPP client channel - Auron Gateway

SMPP client channel

Review channel settings

Your channel list should now look like this:

Email forward channels

Email forward channels

Setting up a forwarding trigger

A trigger is a short Javascript, VBScript or SQL Script that runs when a message is received or when a message changes state.

You can setup a trigger completely from scratch but the SMS Server contains a lot of script templates as well. Script templates can help you setup certain common behaviors very quickly. Once a script is created from a template it’s very easy to edit the script to fine-tune it.

Start creating a new trigger in the SMS Server manager by following these steps:

  1. Click open the ‘Triggers’ section in the tree view on the left
  2. Click on the ‘New Trigger’ link in the view on the right
  3. Select ‘Forward Trigger Template’ from the list of available trigger templates
  4. Click on ‘Create’
Create Forward Trigger

Create Forward Trigger

This will start up the script template wizard for the forward trigger. This wizard will help you setup the basic forwarding script and will generate all of the code for you.

The forward trigger wizard

Forward wizard page one

Forward wizard page one

On the first page you can select in which language the code should be generated. This is useful when you want to modify the generated script later on.

Forward wizard page two

Forward wizard page two

In the next page you will need to select which channel is the ‘From’ channel and which channel will be the ‘To’ channel. Messages from the ‘From’ channel will be forwarded to the ‘To’ channel.

As you can see this forward trigger can easily forward SMS to e-mail as well or any other combination.

Forward wizard page three

Forward wizard page three

In the last page you will need to specify what the forward message should look like. You can do this through a combination of static text and place holders.

Click on the ‘+’ buttons in this screen to see what placeholders are available and to insert them directly.

In this example every e-mail will forward to ‘+31623350288’ and contains the full ‘Plain text’ body of the original e-mail message.

But there are plenty of other possibilities too. For instance if your e-mail will always contain a phone number in the subject of the email you could use the ‘%SUBJECT%’ placeholder in the ‘To Address Field’.

Click on ‘Finished’ when you are done.

Enable Forward Trigger

Enable Forward Trigger

You will now see the trigger in the trigger view. The trigger is disabled by default so it won’t interfere with your existing configuration.

Click on the checkbox to the left of the trigger to enable and test the trigger.

In Conclusion

You can now test this trigger by sending an e-mail to your e-mail address. The SMS Server will receive it and automatically forward it to your mobile.

You can edit the trigger script and add more functionality to it. If you want to add more forwarding triggers or if you want to start over again you can run the same wizard multiple times to generated multiple triggers.