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
- At first, open a mail folder.
- Then, click into the search box above the mail list.
- Next, click “All Mail Items” in “Scope” group on “Search” tab.
- Then, click “From” button in “Refine” group.
- Replace “Sender Name” in search box with the specific contact email address.
- At once, all the items from this contact will be listed.
- Now, select the mail items only and press “Delete”.
- After that, clear up the search criteria and click “Sent To” > “Sent to Another Recipient”.
- Next, change “Recipient Name” with the contact’s email address.
- Later, select the found emails and press “Delete”.
Method 2: Batch Delete with Outlook VBA
- For a start, launch Outlook VBA editor via “Alt + F11”.
- 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
- Later, add this macro to Quick Access Toolbar with reference to “How to Run VBA Code in Your Outlook“.
- Finally, select a contact and click the macro button in Quick Access Toolbar.
- At once, all the emails from or to this contact will be deleted.
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.
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
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?
(647) 503 0317