MATLAB Answers

How I could set up a listener and for an event (new email in my mailbox) in Outlook with MATLAB?

1 view (last 30 days)
I need to listen the mails (of my Outlook mailbox) and if a new mail comes in my mailbox to trigger a function.
Thanks

Accepted Answer

Mario Malic
Mario Malic on 31 May 2021
Hey,
When numUnreads changes, you can run your function.
hOutlook = actxserver('Outlook.Application');
nameSpace = hOutlook.GetNamespace("MAPI");
inboxFolder = nameSpace.GetDefaultFolder(6); % https://docs.microsoft.com/en-us/office/vba/api/outlook.oldefaultfolders
numUnreads = inboxFolder.UnReadItemCount
  4 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by