OUTLOOK- Start-Rules-Create a rule, click the Advanced Options button, and then define the judgment condition, the action of checking the condition (for example, you can choose to display the mail in the new mail notification window) and the exception condition.
Should be able to meet your requirements, no need to write additional scripts.