PDA

View Full Version : Move emails that contain an ID number to a folder



mtwa
06-18-2020, 11:36 AM
Hi there,

Ive been looking for some time and trying new things however i cant figure it out.

We have ID numbers that start with the letter K followed by 6 to 8 numbers e.g K123456 or K87654321

80% of the time customers include this ID in the Subject line however some put it in the email itself.

Is there a way to get these messages filtered into a folder called 'Case Updates'

e.g when an email arrives if it contains K and a number from 100000 - 99999999 then mark as read and move to Case Updates

Thank You in advance for any help

Matt

gmayor
06-18-2020, 08:01 PM
Use a rule that processes all incoming messages with the following script


Sub MoveID(oItem As MailItem)
Dim strSubject As String
Dim olFolder As Folder
olFolder = Session.GetDefaultFolder(olFolderInbox).folders("Case Updates")
If TypeName(oItem) = "MailItem" Then
strSubject = oItem.Subject
If strSubject Like "*K###### *" Or strSubject Like "*K####### *" Or strSubject Like "*K######## *" Then
oItem.Move olFolder
End If
End If
lbl_Exit:
Set olFolder = Nothing
Exit Sub
End Sub