0

Can I please ask for some support on this issue.

Our client has an Exchange 2019 Server (Running on Windows Server 2019) They want to run some VBA code when an email is received to a specific mailbox - 24 hours a day - however -

They don't have a server that can run Outlook to run the VBA against (Server being available 24 hours a day) and their client PC's can get switched-off

Is there some way to monitor a mailbox and trigger the running of VBA code upon receipt of an email?

Any help and guidance would be much appreciated.

Thank you

Andy

Andy Keen
  • 1
  • 1

2 Answers2

1

I am not sure what tools are available to you; however, based on some of my past experiences, I would recommending using the EWS Managed API. If familiar with PowerShell, borrowed a little bit of logic from the EWS Powershell Module (written by BartekB. While I had to mostly rewrite and extend the EWS module from GitHub, for your purposes there should be enough there (if you're familiar enough with PowerShell) to create a script that connects to a mailbox and searches for messages matching a pattern, and then trigger the code given the receipt of a certain message.

Once in place, call the script from a scheduled task running on a computer that has the EWS Managed API installed (could be a server). You will likely need to run the script under the mailbox owner's account, or you will need to configure ApplicationImpersonation for the mailbox in question to the account running the script. The account that runs the script must either have a mailbox, or be a mail user.

Semicolon
  • 1,646
  • 7
  • 7
  • +1, as with EWS API you can create a dot NET application easilly too, some example [there](https://blog.kloud.com.au/2016/04/19/programmatically-read-email-from-an-exchange-sever-mailbox/). It's the new way to pull Exchange Server. – yagmoth555 Oct 28 '19 at 16:58
0

You need to add an event listener to the Inbox which will process incoming messages. And restart Outlook for the code to become active. Here’s a similar article for your reference.

Joy Zhang
  • 1,002
  • 1
  • 4
  • 5