Outlook 2010 rule based only on TO field (ignore CC field)


There is already a similar question, but it doesn't work for me because I'm not a direct recipient (I'm member of a group).

I'm trying to set up a new rule for incoming messages.
Suppose we have

# GroupA
# GroupB

and a message arrives

TO: # GroupA
CC: # GroupB

I have a rule set up, which is saying:

Apply this rule after the message arrives
where sent to # GroupB
move it to the ToGroupB folder

But this detects # GroupB as a recipient, so it moves the message to the ToGroupB folder, which is not what I want.
Can I have a rule which works only based on TO field?

Best Answer

  • Outlook built-in rules cannot distinguish between To and CC. You will need a VBA script for that.

    To use such a script, create a rule with the condition "Sent to people or group", entering the address you want to filter on. This rule will apply only to mail where the address is in the To or CC field. The script will check the To field for an address or alias and only if found move the message to a subfolder of the Inbox.

    Create a rule with the Run a script action, choosing a similar script to the following (untested) script:

    Sub MoveMail(Item As Outlook.MailItem)
        Dim strID As String
        Dim objMail As Outlook.MailItem
        strID = Item.EntryID
        Set objMail = Application.Session.GetItemFromID(strID)
       If objMail.To = "GroupA" Then
          objMail.Move Session.GetDefaultFolder(olFolderInbox).Folders("subfolder-name")
       End If
    Set objMail = Nothing
    End Sub

    Source : Move messages CC'd to an address.

    Note that the MailItem.To Property returns a semicolon-delimited String list of display names for the To recipients. If there are more than one recipient, some more VBA is required.

  • Related Question