Skip to main content

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:

doc move emails from unknown 1

2. Then click Home > Rules > Manage Rules & Alerts, see screenshot:

doc move emails from unknown 2

3. In the Rules and Alerts dialog box, click New Rule under the E-mail Rules tab, see screenshot:

doc move emails from unknown 3

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:

doc move emails from unknown 4

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:

doc move emails from unknown 5

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:

doc move emails from unknown 6

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:

doc move emails from unknown 7

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:

doc move emails from unknown 8

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

doc move emails from unknown 9

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:

doc move emails from unknown 10

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 ProBatch 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.

Read More       Free Download      Purchase
 

 

Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations