Message Recall Sucks
If you find yourself in the predicament that you have sent and email accidentally (or your superiors have done this and asked you to inter vein), the message recall has seemed useless in my previous experience. Especially with today’s escalating use of smart phones (and Blackberries use to be a pain in the rear).
Poweshell can be a blessing and, fortunately, for the amateurs (me included), we have google to rely on when stuck in these exact situations.
Use the following commands to search a specific mailbox for a specific subject or keywords and delete the emails.
Search-Mailbox -Identity "username or alias" -SearchQuery 'Subject:" Your query "' -DeleteContent
You will be prompted for confirmation, so just hit “Y” or hit enter to confirm.
Sometimes it is not just to one person, but a “company wide” email or something similar. you can use “A” to apply the confirm for “All” prompts, or just use the force switch.
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Subject:"Your query"' –DeleteContent
I don’t suggest running scripts blindly without seeing the output first, so you may want to be sure it will delete the correct email. Perhaps it was a “reply all” with the same subject, but you don’t want to delete everyone’s email, just yours. In this case, you can dump the results to another mailbox and review the results to make sure yours is the only one it will affect.
Get-Mailbox -ResultSize unlimited | Search-Mailbox -SearchQuery 'Your Query ' -TargetMailbox "Target Mailbox Name" -TargetFolder "Your Target folder"
When the search is completed, use the Outlook Client or OWA to access the target mailbox and review the results. If it has multiple emails, you can further filter the results with other fields, ie. time, body, etc.
Once you confirm this is the correct and only email, you can then append the “-DeleteContent” switch as such:
Get-Mailbox -ResultSize Unlimted | Search-Mailbox -SearchQuery 'Your Query ' -TargetMailbox "Target Mailbox Name " -TargetFolder "Your Target folder" –DeleteContent
Instead of searching *all* emails in your org, you may have only sent this to a DL or just a few people. In this case, you can define the mailboxes in a text file and loop through the list.
get-content users.txt | Get-Mailbox -ResultSize Unlimted | Search-Mailbox -SearchQuery 'Your Query ' -TargetMailbox "Target Mailbox Name " -TargetFolder "Your Target folder"