How to Auto Block or Delete the Incoming Emails without Recipients in Outlook

Have you ever received the emails which do not have recipients? A great number of users are disturbed by such emails. And sometimes, Outlook’s native “Junk Email Options” is unable to block them. So, this article will help you get rid of them via VBA code.

Outlook has the inbuilt “anti-spam” feature – “Junk Email Options”, but multiple users complain that it doesn’t play a good role. For instance, it frequently blocks the genuine emails. Thus, many users prefer to disable the native function. Then, to block the spams, they will utilize the other means, such as rules.

Inbuilt Anti-spam: Junk Email Options

However, Outlook rule isn’t mighty. For example, rule is unable to check whether an incoming email has recipients or not. Since the emails without recipients are spam normally, you want to block them via rule. But, in fact, rule is incompetent to this task. Therefore, here we will introduce you an effective way. It’s using VBA code to get it. If you don’t know to use VBA, just refer to the article – “How to Run VBA Code in Your Outlook“.

Auto Block or Delete the Incoming Emails without Recipients

  1. To begin with, launch your Outlook program.
  2. Then, tap on “Alt + F11” to access Outlook VBA editor.
  3. Next, in the new screen, put the following code into the “ThisOutlookSession” project.
Public WithEvents objInboxFolder As Outlook.Folder
Public WithEvents objInboxItems As Outlook.Items

Private Sub Application_Startup()
    Set objInboxFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)
    Set objInboxItems = objInboxFolder.Items
End Sub

'Process every new item arriving in Inbox
Private Sub objInboxItems_ItemAdd(ByVal objItem As Object)
    Dim objMail As Outlook.MailItem
    Dim objJunkFolder As Outlook.Folder

    If TypeName(objItem) = "MailItem" Then
       Set objMail = objItem
       If objMail.Recipients.Count = 0 Then
          'Move to Junk Email folder
          Set objJunkFolder = Application.Session.GetDefaultFolder(olFolderJunk)
          objMail.Move objJunkFolder
          'objMail.Delete ==> delete it
       End If
    End If
End Sub

VBA Code - Auto Block or Delete the Incoming Emails without Recipients

  1. Subsequently, restart your Outlook to activate this mail.
  2. From now on, every time when an email arrives in Inbox, Outlook will auto check its recipients. If it doesn’t have recipients, it’ll be moved to Junk Email folder or directly deleted according to the code.

Do with Vexing Outlook Issues

It is likely that you are encountering a variety of issues in your Outlook from time to time. For instance, when you try to open a lot of items at once, Outlook is stuck in “not responding”. Or due to frequent improper shutdown, Outlook crashes and Outlook data file gets corrupted. In a nutshell, to some extents, Outlook problems are inevitable. Thus, you have to prepare for them. For example, to fix PST file as soon as it is damaged, you are better off keeping a robust and trustworthy repair tool nearby, such as DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupted mdf and outlook repair software products. For more information visit

Comments are closed.