I’m writing a macro that creates tickets on a database based on alerts received from a Nagios server as an email. However, I cannot let the macro run in an infinite loop while checking for mails because it is just too resource heavy and makes my desktop hang. I need to find a way to trigger the macro only when a new mail is received.
I looked for something along the lines of NewMail events on the MSDN website, but I can’t find anything coherent. Can anyone show me just a bit of sample code to show how to trigger macros from new mail events?
This code will add an event listener to the default local Inbox, then take some action on incoming emails. You need to add that action in the code below.
After pasting the code in
ThisOutlookSessionmodule, you must restart Outlook.