0

I have created a rule where the subject line contains

A Document has been assigned to You

It also routes the emails with subject

A Document has been assigned to Your group

How can I fix this? Is there a regular expression available?

Community
  • 1
  • 1
Joe_12345
  • 589
  • 2
  • 7
  • 19
  • See if you can run an earlier rule on the unwanted subject to "Stop processing more rules". – niton Jun 14 '20 at 16:51

1 Answers1

0

You can develop a VBA macro that can handle incoming emails. The NewMailEx event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item.

The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item. Use this method with caution to minimize the impact on Outlook performance.

Public WithEvents outApp As Outlook.Application

Sub Intialize_Handler()
    Set outApp = Application
End Sub

Private Sub outApp_NewMailEx(ByVal EntryIDCollection As String)
    Dim mai As Object

    Set mai = Application.Session.GetItemFromID(EntryIDCollection)
    MsgBox mai.Subject

End Sub

You can use regular expression in VBA macros, see How to Use/Enable (RegExp object) Regular Expression using VBA (MACRO) in word for more information.

Eugene Astafiev
  • 47,483
  • 3
  • 24
  • 45