E-mail to a phone number
This how-to describes how to setup the Auron SMS Server to e-mail to a phone number. The e-mail will arrive as an SMS on the target phone.
We’ll assume that you already have the Auron SMS Server setup on a local windows server. Also, you’ll have a Microsoft Exchange or Lotus Notes server setup to relay messages to a given subdomain to this server.
Jump to section:
- Setup an e-mail server
- Pickup incoming e-mails
- Setup SMS channel
- Forward e-mail file to SMS
- Testing our solution
Setup an e-mail server
First we’ll setup an e-mail server on the Auron SMS Server. This e-mail server will be the relay target on your central MS Exchange or Lotus notes server.
To setup the e-mail server you can simply enable the SMTP server in Window Server like this:
Add a domain alias to the SMTP server by using the IIS Manager:
If you run into issues while editing SMTP properties from the IIS Manager have a look at this FAQ item.
An easy way to test the e-mail server is to create an SMTP e-mail channel. You can then send a test message through this channel to see that it arrives in the drop folder on your server.
By default this configuration works:
Send a new e-mail with the test channel and verify that it arrives in the drop folder:
By default the drop folder for incoming e-mail in the SMTP server will be:
C:\Inetpub\Mailroot\Drop
Pickup incoming e-mails
Now that we’re capturing incoming e-mail we’ll have to introduce them into the Auron SMS Server. The best way to do this is via a File channel.
Setup your file channel like this:
Setup SMS channel
Before we can start forwarding we’ll also need an SMS channel to forward to. This can be either GSM, SMPP, HTTP or Android or a combination. You can choose which is most convenient for you.
By now you should have at least three channels:
Forward e-mail file to SMS
We now have a situation where you can send an e-mail to a phone number and that e-mail appears automatically in the Auron SMS Server as a file. In this step we’ll automatically forward this e-mail to an SMS by creating a new trigger.
We’ll start with creating an empty VBScript trigger that runs when a file is received:
Next go to the VBScript tab and edit the script:
CONST STR_DEBUGFILE = "C:\ProgramData\Auron\SMS Server\Log\TRIGGER1.txt"
CONST B_ENABLE_DEBUG = True
' // ========================================================================
' // Function: ProcessMessageEx
' // ------------------------------------------------------------------------
' // ProcessMessageEx trigger function to process incoming messages
' // ========================================================================
Function ProcessMessageEx(objMessageIn, objMessageDB, dctContext)
Log ">> ProcessMessageEx"
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objFile = objFso.CreateTextFile("c:\temp\in.eml", True)
objFile.WriteLine(objMessageIn.Body)
objFile.Close
Set objEmail = CreateObject("AxEmail.Message")
objEmail.LoadMime("c:\temp\in.eml")
If objEmail.LastError <> 0 Then
objMessageIn.AddTrace "Error while opening MIME"
objMessageIn.StatusID = "FAILED"
Log "Error while opening MIME"
Log "<< ProcessMessageEx"
Exit Function
End If
Set objSms = objMessageDB.Create("SMS")
objSms.ToAddress = Left(objEmail.ToAddress, Instr(objEmail.ToAddress, "@") - 1)
objSms.Body = objEmail.BodyPlainText
objMessageDB.Save(objSms)
Log "<< ProcessMessageEx"
End Function
This script works by reading the e-mail file into an e-mail object and creating a new SMS using the plain text body of the e-mail. The e-mail message object is a part of the Auron E-mail component which comes with the Auron SMS Server.
Testing our solution
We’re ready to send a test e-mail to our new e-mail server and very that it’s send as an SMS.
First create a new outgoing e-mail through our test SMTP channel:
If you have correctly integrated with your Microsoft Exchange or Lotus Notes configuration you should be able to send an e-mail to a phone number from any e-mail client in your office.
Verify the handling of incoming e-mails:
The last screenshot shows two successful results:
- The e-mail is sent on the test SMTP Channel
- The e-mail file is picked up from the drop folder by the File channel
- The file is converted into an SMS and sent by SMS channel