Delete the same email from multiple inboxesPosted on 15 July 2019 by Beaming Support
If you believe an email contains a malicious link or attachment, or have deemed it unsuitable to be viewed by members of your organisation for any reason, you might need to bulk delete that email message from multiple mailboxes using a Powershell command.
The following instructions are for Office 365 admins that would like to delete a specific email from the inboxes of all users in the organisation.
The Powershell Command
The first thing you will need to do in order to delete the same email from multiple inboxes is connect to Office 365 using Powershell then run a report which will simply gather the information together so that you can see what will be deleted once you run the “Delete” command.
Get-Mailbox -ResultSize unlimited | search-mailbox -SearchQuery ‘(From:”Insert_Senders_Email_Address“) AND (Subject:”Insert_Subject_Of_Email“) AND (Received=Insert_Date_Recieved)’ -TargetMailbox Destination_Mailbox_for_Report -TargetFolder “Name_Of_Log_Folder” -LogOnly -LogLevel Full
The command above has sections highlighted in bold, these sections are the areas for your input. The sender’s address will need to be the full email address of the user. The subject area is more like a wildcard and will include anything that matches the statement mentioned in the quoted box. The date will need to be in the correct format for your region (Eg. 23/01/2019 in the UK).
The part of the command which specifies the destination mailbox can simply be the internal reference for the company. For example, if you connected to office 365 with ITsupport@example.com, you would merely need to put in “ITsupport” . The last section is the “Name of log folder”, this will be the name of the folder that will be created by the command within the ITSupport@example.com mailbox.
Once you run the command it will generate a CSV file with the output of the command so that you can check over which emails will be deleted.
Once you are happy that the CSV only displays the emails that you want to be delete from all mailboxes in the organisation, you can then run the following command.
Get-Mailbox -ResultSize unlimited | search-mailbox -SearchQuery ‘(From:”Insert_Senders_Email_Address“) AND (Subject:”Insert_Subject_Of_Email“) AND (Received=Insert_Date_Recieved)’ -TargetMailbox Destination_Mailbox_for_Report -TargetFolder “Name_Of_Log_Folder” –DeleteContent -Force
This will process and delete all emails matching the criteria from all mailboxes in the organisation.
A weight off your mind
Partner with Beaming for your business connectivity and let us take care of everything.
I’m unable to share SharePoint links with external users12/06/19 Support team
You don’t have appropriate permission to perform this operation in Outlook24/05/19 Support team
Receive an email alert when a RAID array disk is predicted to fail17/04/19 Support team
Businesses we’ve helped
Adams & Jarrett
Moving their telephone system to the BeamRing cloud gave Adams and Jarrett the freedom of a simplified, customisable setup paired with improved functionality and reduced call costs.
When tracking ships on the high seas and providing timely intelligence in the fight against piracy, 24/7 connectivity is crucial.
- Leased Lines
Connectivity was crucial to ensure the Pier could operate smoothly, to enable commerce and provide visitors with a truly engaging experience.
- Data Security
Old Hastings House
The team at Old Hastings House care home found it paid to find a partner who put their needs first.
When your business is consistently and fundamentally affected by changes in technology, it makes a lot of sense to monitor the situation on a regular basis
- Leased Line
By wisely embracing new technologies with the help of Beaming’s connectivity, McPhersons Chartered Accountants have their nose out in front.