How to create an Email to SMS Gateway
Posted on March 29th, 2010 by Richard.
Categories: Email to SMS
Tags: email, gateway, sms
This document explains how you can use postfix to call a script, with the result that you can then interface email to our RestFul SMS gateway API or our Simple SMS Gateway API.
We also have a EMAIL to SMS GATEWAY product, the link provides full details.
Integrating Email to our SMS Gateway
You will require some programing knowlege to configure your systems to send email to the SMS API. We will be using email piping to achieve this goal.
Step 1. Configure email piping.
In this example we will be using Postfix (the common open source SMTP server).
First configure an email account (from the sms user account) you wish to send the SMS mail to, for example sms@mydomain.com. This email address will receive all the emails that will get converted into SMS. Then:
- Edit alises
- # nano /etc/aliases
- Add the alias with piping to the file:
- sms: “|/var/www/scripts/emailGateway/processEmail.sh”
- Save and exit and update aliases database:
- # newaliases
Next is to set up the routing in postfix to point to the “sms” alias.
- Edit the virtual file of postfix:
- # nano /etc/postfix/virtual
- Add the routing info:
- sms@mydomain.com sms
- Save and exit.
- Now edit the postfix config file to use the virtual database:
- # nano /etc/postfix/main.cf
- Add the following line:
- virtual_maps = hash:/etc/postfix/virtual
- Save and exit.
- Note: This is only needed if postfix hasn’t been configure to work with the virtual database yet, if you find the above line already in the config file just ignore this step.
- Reload Postfix:
- # postfix reload
Step 2. Read and process the email data
Next up is to create the file processEmail.sh this is the shell script that will get called when email arrives at the SMS account. In our example we are going to get it to call a php script like this:
php /var/www/scripts/emailGateway/send.php
$FileHandler = fopen("php://stdin", "r");
if ($FileHandler > 0)
{
while(!feof($FileHandler))
{
$RawEmailContent .= fgets($FileHandler, 120);
}
}
This will read the email data into a string which you can then parse and send to our API, see our API documentation
Popularity: 14%
Related posts:
- Using our short code and gateway APIs to create a game
The Concept To create an interactive game using Text Messaging and to show how easy it is to create interactive... - Text Marketer short code / txtUs API options
Introduction The keyword on your system (on short code 88802) or your txtUs number can be used to “route” incoming... - How to use an SMS Gateway
Our SMS Gateway is extremely powerful indeed. It allows companies to connect to our systems and send out messages 1... - Upload a list of mobile numbers to a group
This article shows you how to upload a simple mobile number list with no other data fields. For help on... - Changes to Delivery Reporting
Message id’s are now also included in your delivery report file, this change is only really relevant for API users,... - How to integrate our SMS Gateway API into your systems
Introduction Adding SMS as a communication method to a system is often very useful, for instance you don’t have issues... - The SMS Gateway
How to use an SMS Gateway Continue reading →... - SMS Gateway API – Specification
This blog post has been superseded with our website documentation It is recommended that you use the RESTful version of the API which has largely superseded this document... - Example of a Delphi/Pascal Interface for the Bulk SMS Gateway / API
For more information regarding the bulk sending API click here. A code example for sending SMS via a Delphi Pascal... - System Update – Upload your mobile numbers straight from Microsoft Excel
The development team at Text Marketer have had a busy few months and the latest system improvement has now been...



