2 Means to Batch Delete All Emails Sent From or To a Specific Outlook Contact

Sometimes, you may want to batch delete all the emails that are sent from or to a specific contact. Now, in this article, we will introduce you 2 methods to effectively get it.

In some cases, you may need to batch delete some emails. For instance, a specific contact resigned from your company, thus you want to batch delete all the emails sent from or to this contact. In general, you can use the following Method 1 to get it manually. However, in fact, Method 2 shared here is much more efficient due to the usage of VBA. Now, read on to get the 2 ways in detail.

Method 1: Delete Manually after Searching

  1. At first, open a mail folder.
  2. Then, click into the search box above the mail list.
  3. Next, click “All Mail Items” in “Scope” group on “Search” tab.
  4. Then, click “From” button in “Refine” group.click "From" button in "Refine" group
  5. Replace “Sender Name” in search box with the specific contact email address.Enter Sender Name
  6. At once, all the items from this contact will be listed.
  7. Now, select the mail items only and press “Delete”.Delete Found Emails
  8. After that, clear up the search criteria and click “Sent To” > “Sent to Another Recipient”.Send to Another Recipient
  9. Next, change “Recipient Name” with the contact’s email address.Change Recipient Name
  10. Later, select the found emails and press “Delete”.

Method 2: Batch Delete with Outlook VBA

  1. For a start, launch Outlook VBA editor via “Alt + F11”.
  2. Then, put the following code into a module.
Dim objContact As Outlook.ContactItem
Dim strEmailAddress1, strEmailAddress2, strEmailAddress3 As String

Sub BatchDeleteAllEmailsFromToSpecificContact()
    Dim objOutlookFile As Outlook.Folder
    Dim objFolder As Outlook.Folder

    Set objContact = Outlook.ActiveExplorer.Selection(1)
    strEmailAddress1 = objContact.Email1Address
    strEmailAddress2 = objContact.Email2Address
    strEmailAddress3 = objContact.Email3Address

    Set objOutlookFile = Outlook.Application.Session.PickFolder

    If Not objOutlookFile Is Nothing Then
       For Each objFolder In objOutlookFile.Folders
           If (objFolder.DefaultItemType = olMailItem) And (objFolder.Name <> "Deleted Items") Then
               LoopFolders objFolder
           End If
       Next

       MsgBox "Complete!", vbInformation
    End If
End Sub

Sub LoopFolders(ByVal objCurFolder As Outlook.Folder)
    Dim i As Integer
    Dim objMail As Outlook.MailItem
    Dim objSubfolder As Outlook.Folder

    For i = objCurFolder.Items.Count To 1 Step -1
        If objCurFolder.Items(i).Class = olMail Then
           Set objMail = objCurFolder.Items(i)

           If objMail.SenderEmailAddress = strEmailAddress1 Or objMail.SenderEmailAddress = strEmailAddress2 Or objMail.SenderEmailAddress = strEmailAddress3 Then

              objMail.Delete
           ElseIf objMail.Recipients.Count = 1 Then
              If objMail.Recipients(1).Address = strEmailAddress1 Or objMail.Recipients(1).Address = strEmailAddress2 Or objMail.Recipients(1).Address = strEmailAddress3 Then

                 objMail.Delete
              End If
           End If
       End If
    Next

    If objCurFolder.Folders.Count > 0 Then
       For Each objSubfolder In objCurFolder.Folders
           LoopFolders objSubfolder
       Next
    End If
End Sub

VBA Code - Batch Delete All Emails Sent From or To a Specific Outlook Contact

  1. Later, add this macro to Quick Access Toolbar with reference to “How to Run VBA Code in Your Outlook“.
  2. Finally, select a contact and click the macro button in Quick Access Toolbar.
  3. At once, all the emails from or to this contact will be deleted.Deleted Emails

Recover Accidentally Deleted Items

Human errors are inevitable to some extent. For example, when cleaning up the old items in your Outlook, you may mistakenly delete some useful items. In such a case, you can take recourse to experienced Outlook recovery software, such as DataNumen Outlook Repair to restore them.

Author Introduction:

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

One response to “2 Means to Batch Delete All Emails Sent From or To a Specific Outlook Contact”

  1. Hi,
    Are you still in business?
    I found a few errors on your site.
    Would you like me to send over a screenshot of those errors?

    Regards
    Jacob
    (647) 503 0317

Leave a Reply

Your email address will not be published. Required fields are marked *