Is it Possible to Monitor Outlook Desktop for New Emails ?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
shipaddicted
Posts: 106
Joined: 15 Jul 2016, 19:57

Is it Possible to Monitor Outlook Desktop for New Emails ?

Post by shipaddicted » 02 May 2024, 22:42

I am wondering if it's possible to monitor my Outlook inbox for new emails, and if the subject line matches specific text, save that subject line to my .ini file.

Long story short: Apparently, Salesforce is changing the way you can "email to case" and my old way doesn't seem to work anymore (using the case reference ID in the email body). So I have had to develop a workaround for now, until I can convince my IT team at work to add a new field to the cases that does work. I have found that the Case.Thread_Token will work about the same -- the only problem is this field isn't visible when I create/view cases.

So I have to send an email to myself from the case with the Case.Thread_Token in the subject line (along with some other identifying info). Then I have to go to Outlook, find that email, and then save that subject line to my .ini file.

I have scripts that will do both tasks, but I'm trying to figure out if I can automate this a little further and somehow monitor my Outlook inbox for any new emails contacting specific text, and if it does, save that email's subject line to my .ini file automatically. I looked through the COM functions, but nothing popped out at me that I could use. Any suggestions?

User avatar
Datapoint
Posts: 300
Joined: 18 Mar 2018, 17:06

Re: Is it Possible to Monitor Outlook Desktop for New Emails ?

Post by Datapoint » 03 May 2024, 00:34

You could connect to the Outlook Event that is fired when an email is received. Here is a function/example I wrote that could be adapted:

v1 example It's v1 code, but it would be almost identical in v2. Look for the heading that says "Outlook Events". You will need to un-comment the function NewMailEx(). That function will be called when a NewMailEx event is triggered in Outlook.

v2 events example Excel, v2 example.

For more info you could also search for Outlook event.

shipaddicted
Posts: 106
Joined: 15 Jul 2016, 19:57

Re: Is it Possible to Monitor Outlook Desktop for New Emails ?

Post by shipaddicted » 03 May 2024, 20:16

Excellent!! I will see what I can do with these. They will be a lifesaver. Having to do everything with my workaround today was about to make me flip out. I kept forgetting the new steps and having to start everything all over again ... ugh .

Post Reply

Return to “Ask for Help (v2)”