Outlook advanced rules for client codes

Joel 1 Reputation point
2021-03-10T15:12:19.88+00:00

My advertising company has client codes for Radio and TV: for example PRAE00001T for TV spots or PRAE00002R for radio spots. There is always a 4 letter client code followed by 5 digit spot number that ends with a R for radio or T for TV.

Is it possible to add a rule to Outlook that moves all the radio spots into their own folder?

I'm new to using rules so feel free to assume I don't know the basics. I'm using Outlook app on a PC.

Thank,
-Joel

Microsoft 365 and Office Development Other
Outlook Windows Classic Outlook for Windows For business
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jade Liang-MSFT 9,986 Reputation points Microsoft Employee
    2021-03-11T07:20:36.37+00:00

    Hi @Joel ,

    Welcome to our forum.

    for example PRAE00001T for TV spots or PRAE00002R for radio spots

    Where were these client codes in your emails(emails subject, emails content or sender address)? And are these 4 letters a fixed value-"PRAE"?

    For your requirement, we may need to create a rule with wildcards, which is actually not supported on Outlook based feature. In this case, we could try to use wildcards in a script, and create a rule to run this script automatically. Based on my research, I found a related article : To create a rule with wildcards (Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.)

    If your client code is in your subject and the 4 letter is fixed, I have tried to modify the script and test on my Outlook 365, and found it could work for me---messages' subject with "PRAE?????T" would move to T folder under Inbox, messages' subject with "PRAE?????R" would move to R folder under Inbox. For your reference:

    Sub MoveInvoices(Item As Outlook.MailItem)  
    Dim MoveFolder As Folder  
    Set MoveFolder = Session.GetDefaultFolder(olFolderInbox)  
    Set MoveFolder_t = MoveFolder.Folders("T")  
    Set MoveFolder_r = MoveFolder.Folders("R")  
         If LCase(Item.Subject) Like LCase("*#####T*") = True Then  
          Item.Move MoveFolder_t  
      End If  
       If LCase(Item.Subject) Like LCase("*#####R*") = True Then  
          Item.Move MoveFolder_r  
      End If  
    End Sub  
    

    You could paste this script in your visual basic pane(Alt+F11) in Outlook, save it and create a rule to run this script(Rules>Manage rules and Alerts>Apply this rule for the messages I receive>choose condition for your need, or you could not choose it and the rule would apply to all messages you received>choose action "run a script", choose this script>apply).

    Hope that would be helpful to you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.