SMS Alerts of Outlook Mails – Configure your own Gateway
April 7, 2010
Programming Outlook Client to Send SMSs to your Indian Mobile Phone
Raj has to miss out his normal exercise routine because he needs to wait for some emails that are required to be processed immediately as they are received. The moment Raj receives the mail, he needs to acknowledge the sender and then forward the mail to the next stakeholder for their action. He is left with nothing but to sit in front of his outlook client, and wait for the mail when its received from one stakeholder, passed on to the other and then again the same cycle.
Amit wants to go for a cup of coffee with his girlfriend, but since he is waiting for an important mail, his mind is always stuck at his inbox, even when he is on a date. Amit is anxious if the mail has arrived…
If you are Raj or Amit, then you can ease off your life by a little automation, without any extra cost. Imagine, when a mail arrives in your inbox, your phone beeps the SMS tone and you have the subject of the email in your message box; and for this, you dont need a blackberry, a smart phone, an iPhone, a HiPhone. Normal GSM phone that can receive messages will suffice.
What do you need in Place?
What you need to let this run is:
-
Running outlook client that is able to accept incoming mails.
-
Outlook 2003 and above.
-
Internet connection.
-
An account at 160by2.com or any other free web based SMS portal.
-
An active session to this website (after login etc) so that direct links to compose and send messages would work.
The principle
Since we are not dealing with mail gateways and the dispatch mechanism from mail to SMS will be initiated by the mail client, the working principle is somewhat disjoint.
First, we create a macro, that responds to a “NEW MAIL” event in outlook. Under this event, we need to read the subject of this mail.
Once we are through with this, we open the internet explorer browser using the Internet Explorer Control reference API through VBA in outlook and navigate to the compose page for the SMS.
Typing numbers and mail subject will involve some crude sendkey operations, but in the end, the process works!!
Given below, is the source code of the macro I used to setup the automation.
Private Sub Application_NewMail()
Dim Inbox As Outlook.MAPIFolder
Dim InboxItems As Outlook.Items
Dim Mailobject As Object
Dim oMailItem As MailItem
Dim i As IntegerDim str As String
Set Inbox = Application.GetNamespace(“Mapi”).GetDefaultFolder(olFolderInbox)
Set InboxItems = Inbox.Items
InboxItems.Sort “[Received]“, True
Set oMailItem = InboxItems.GetFirstSet ie = CreateObject(“InternetExplorer.Application”)
ie.Visible = 1
ie.navigate “http://www.160by2.com/compose_sms.aspx“
Do While ie.busy
Loop
Do While ie.ReadyState <> READYSTATE_COMPLETE
LoopDoEvents
Call SendKeys(“981234567″) ‘ your cellphone numberDoEvents
Call SendKeys(“{TAB}”)
Do While ie.ReadyState <> READYSTATE_COMPLETE
LoopDoEvents
Call SendKeys(“{TAB}”)DoEvents
Call SendKeys(“{TAB}”)DoEvents
Call SendKeys(oMailItem.Subject)
DoEvents
Call SendKeys(“{TAB}”)DoEvents
Call SendKeys(“{ENTER}”)‘MsgBox oMailItem.Subject
End Sub
You can also filter on the subjects or senders or send to: in case you would like to receive such SMS alerts
only for some selected mails and not every mail.
Other possible changes could be if you would like to explore the Internet Explorer objects, as I could also suspect some smarted ways of working with forms through document.elements object model of IE.
Probably the next version would be better, but for now, I can have my extended coffee discussions, without risking my critical mails that need attention!
Happy Implementation!!


May 4, 2010 at 4:24 pm
critical mails.. humm.,,, high priority high productivities all at ur end.. man…;-)
May 4, 2010 at 4:39 pm
thanks!! but this is not a very good method as it does not use professional SMS send services or web service engines… but, good for a while or two just to play around with Outlook Programming