My scenario is set up to receive emails, check the body content for specific keywords, and reply (or not) depending on whether those keywords are present.
I have a Webhook (Mailhook) trigger which instantly triggers when it receives an email. The Primary email address (used for work) receives an email and forwards it to the Mailhook. This forwarding is set up through Microsoft 365 directly not Make.
When the Mailhook receives the mail, it passes through a filter which checks the sender’s email address - I only want to reply to one specific email address. This email is called “Referrals” on the screenshot.
I can read the body content from the mailhook module but I cannot receive the specific Outlook Message ID, which is required for the Reply modules later in the Scenario.
My Attempt to receive the Message ID is done through an Outlook (Microsoft 365 Email) Search Module. I previously searched using the Subject Line received in the Mailhook but this would sometimes return the wrong email. I now Search using the function “From:[referrals email] AND Sent:today”. The Sent Today check is an extra security step to ensure it doesn’t reply to an old email by mistake. In the Search Module I also Order By (sort) receivedDateTime desc to get the most recent email. I also limit return parameters to 1.
Note there is a warning Important: this parameter is not supported with Search
. under the Order By section, but I’m not 100% sure what this effects as in all my testing it always returned the most recent email - maybe just luck.
My Issue:
An email came in this morning which, if the scenario ran as intended, would have been replied to. BUT the Search Module didn’t return an output.
I obviously don’t have the search module set up optimally but I’m unsure how to best set it up. Why or How would the Search Module not return an output when the Scenario will only run when there is a new email to output in the first place?
EDIT: I am wondering if the reply is happening TOO QUICK so that the email hasn’t fully loaded on the Outlook server? Is that a possibility? I say this as I just ran a test run and the search module successfully found the old email (the one from the failed run) as it should have in the first place?
The function of this email is to win work and emails require a reply within 1min to have a chance of successfully winning the job.
Let me know if you need anymore clarification - thanks to anyone who can help.