Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

New Mail Notication (how to detect)

Okay, I'm VERY new at Outlook programming, but have no problem with Visual Basic programming.

I want to write either a stand-alone program or internal module that will DETECT a new mail and then kick on an appropriate method.  In other words, I want Outlook to automatically detect & then check the details of an incoming e-mail and react accordingly (if its the e-mail that supposed to be processed).  PLEASE, can anybody tell me how I can do this.
0
andrew_e
Asked:
andrew_e
  • 2
1 Solution
 
Neo_mvpsCommented:
The solution to your problem depends on the mode and version of Outlook.  For example, Outlook 2000 is the first client to have an extensive VBA model that can notify a COM Object of an event like new mail or an addition of an item to a folder.

If using a previous version or Windows Messaging, then one must rely on C++ development and the IEXCH and MAPI events. (Not to many books left out in the wild on these topics.)

0
 
BodyaCommented:
If you have Outlook 2000, with it's VBA model , as Neo_mvps note, you should add a reference to Ms Outlook Object Library to your VB project, and declare in a class module an Outlook.Application object "With Events".
To start programming Outlook look at
http://www.vb-world.net/articles/outlook/
 http://www.microsoft.com/OutlookDev/Articles/outprog.htm

If you have an older version I recommend you to write a stand-alone application which checks the contents of Inbox periodically. The way Neo_mvps proposed, seems to be very complicated.
0
 
andrew_eAuthor Commented:
Thanks for the info.

I'm using Outlook 97, so I think I'm going to use the "open"-event to activate the VB-created module that does the attachment manipulation.  I might consider writing a VC++ service program that periodically checks the inbox at a later stage.
0
 
BodyaCommented:
If my memory serves me right (now I have Outlook 2000 and can't prove it :( ) in Outlook 97 there was no Application_NewMail event. Yes, the MailItem object had Open event but you won't be able to use it for notification of a new mail. I can imagine the only way - if you design an outlook custom form and there write using VB Script a handler to Open even, which is to call your application.
But if you want to process all mail (not only from those users in your corporation who use your custom form) you should use a periodicall scanning of Inbox or MAPI events.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now