Home > Code, VB > Outlook txt alerts

Outlook txt alerts

Like many people I use Outlook at work for mail and calendaring. However Android doesn’t yet have a free solution for checking mail, and other non-smart phones may not either. I can use the webmail interface, but its not convenient to check that all the time. Also, I have a pager at work for times and places that I can’t have my phone with me, it would be nice to get notifications and email alerts on my pager. Luckily Outlook has some nice macro features to solve this. I setup a macro to send a page with the From and Subject lines from the mail on receipt. This can also be extended to send a txt message to your phone with the same info, or hook the meeting reminders and forward those as well.

Simply go to Tools -> Macro -> Visual Basic Editor and click on “TheOutlookSession” in the project pane. Add this code:

Sub PageMe(MyMail as MailItem)
    Dim strID as String
    Dim olNS as Outlook.NameSpace
    Dim msg as Outlook.MailItem
    Dim rply as Outlook.MailItem

    strID = MyMail.EntryID
    Set olNS = Application.GetNamespace("MAPI")
    Set msg = olNS.GetItemFromID(strID)

    Set rply = Application.CreateItem(olMailItem)
    rply.Body = "New mail from: " + msg.SenderName + " Subj: " + msg.Subject
    rply.To = "youremail@here.com"
    rply.Send
    Set msg = Nothing
    Set rply = Nothing
    Set olNS = Nothing
End Sub


Categories: Code, VB Tags: , ,
  1. No comments yet.

Powered by WP Hashcash