How to move emails from unknown senders to a specific folder in Outlook?
In your daily work, you may receive many emails come from unknown senders which are not saved in your Contacts folder. These may be some junk or malicious emails, in this case, you want to auto move these emails to a specific folder instead of the Inbox. How could you solve this job in Outlook?
Move emails from unknown senders to a specific folder by creating rule
Move emails from unknown senders to a specific folder by applying VBA code
Move emails from unknown senders to a specific folder by creating rule
Actually, you can create a rule to move the emails from unknown senders to a specific folder automatically, please do as follows:
1. Create a new folder under the Inbox folder which will place the emails come from unknow senders as following screenshot shown:
2. Then click Home > Rules > Manage Rules & Alerts, see screenshot:
3. In the Rules and Alerts dialog box, click New Rule under the E-mail Rules tab, see screenshot:
4. And click OK button to go to the Rule Wizard, click Apply rule on message I receive option from the Start from a blank rule section box, see screenshot:
5. Then click Next button, in this step, please donβt select any option, and click Next button directly, a warning box is popped out, please click Yes button, see screenshot:
6. And in the next dialog box, check move it to the specified folder option in the Step1: Select action(s) list box, and then click the linked text specified, and in the opened Rules and Alerts dialog, specify the folder where you want to move the emails to, see screenshot:
7. Click OK button, and go on clicking Next button, in this Are there any exceptions dialog, check except if sender is in specified Address Book option in the Step1: Select exception(s) list box, and then click the linked text specified, and an Add Address List box will pop out, select a contacts folder which contains the contacts you want to except, see screenshot:
8. Then click Add button, and then click Next to go to the last wizard dialog, type a rule name in the Step1: Specify a name for this rule text box, and check Turn on this rule option from the Step2: Setup rule options section. See screenshot:
9. And then click Finish and Ok buttons to close the dialogs. From now on, when emails coming from unknown senders, they will be moved to the specific folder automatically.
Move emails from unknown senders to a specific folder by applying VBA code
May be the above method is troublesome for you, here, you can apply a code to deal with it as quickly as you can.
1. Hold down the ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, double click ThisOutlookSession from the Project1(VbaProject.OTM) pane to open the mode, and then copy and paste the following code into the blank module.
VBA code: Auto move emails from unknown senders to a specific folder:
Public WithEvents MailItems As Outlook.Items
Private Sub Application_Startup()
Set MailItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub MailItems_ItemAdd(ByVal item As Object)
Dim xSenderEmailAddress As String
Dim xContactItems As Outlook.Items
Dim xContactItem As ContactItem
Dim I As Long
Dim xFilter As String
Dim xTargetFolder As Folder
Dim xContactFolder As Folder
Dim xStore As Store
Dim xInboxFlds As Folders
Dim xSubFolder As Folder
Dim xFound As Boolean
On Error Resume Next
If item.Class = olMail Then
xSenderEmailAddress = item.SenderEmailAddress
End If
For Each xStore In Outlook.Application.Session.Stores
Set xContactItems = xStore.GetDefaultFolder(olFolderContacts).Items
For I = 3 To 1 Step -1
xFilter = "[Email" & I & "Address] = " & xSenderEmailAddress
Set xContactItem = xContactItems.Find(xFilter)
If TypeName(xContactItem) <> "Nothing" Then Exit For
Next
Next
If xContactItem Is Nothing Then
Set xInboxFlds = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Folders
xFound = False
For Each xSubFolder In xInboxFlds
If xSubFolder.Name = "Unknown" Then
xFound = True
Set xTargetFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Folders("Unknown")
Exit For
End If
Next
If xFound = False Then
Set xTargetFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Folders.Add("Unknown")
End If
item.Move xTargetFolder
End If
End Sub
3. Then save the code and close the code window, and restart the Outlook to make the code take effect. From now on, when the emails coming from some unknown senders, they will be moved to the Unknown folder automatically, see screenshot:
Note: The Unknown folder will be created automatically when there are some unknown emails incoming. You can change the folder name βUnknowβ to others in script.
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
π€ AI Mail Assistant: Instant pro emails with AI magic--one-click to genius replies, perfect tone, multilingual mastery. Transform emailing effortlessly! ...
π§ Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
π¨ Email Management: Easily Recall Emails / Block Scam Emails by Subjects and Others / Delete Duplicate Emails / Advanced Search / Consolidate Folders ...
π Attachments Pro: Batch Save / Batch Detach / Batch Compress / Auto Save / Auto Detach / Auto Compress ...
π Interface Magic: πMore Pretty and Cool Emojis / Boost Your Outlook Productivity with Tabbed Views / Minimize Outlook Instead of Closing ...
π One-click Wonders: Reply All with Incoming Attachments / Anti-Phishing Emails / πShow Sender's Time Zone ...
π©πΌβπ€βπ©π» Contacts & Calendar: Batch Add Contacts From Selected Emails / Split a Contact Group to Individual Groups / Remove Birthday Reminders ...
Over 100 Features Await Your Exploration! Click Here to Discover More.