Houston, we have a problem…

How many time you sent a mail to wrong person? Or maybe you sent a mail and you didn’t finished it or you changed your mind and you wanted to “get back in time” and make that person you sent that mail won’t receive it?

You can’t do that if you sent that mail outside your organization, but luckily if your organization use MS Exchange or like mine has Office 365 subscription you can search mailboxes for a specific email, copy it and of course delete it.

Not everybody can do that. Even a global administrator by default can’t do that. You have to add that person to the Mailbox Discovery Admin Role. Just to make sure that role has assigned Mailbox Import Export and Mailbox Search roles.

After that just connect to your Exchange using PowerShell and just use a Search-Mailbox cmdlet. Simple example how to search for a message with subject “TEST” in mailbox John Smith and just log the result in SearchResult folder in admin@contoso.com mailbox execute that:

Search-Mailbox -Identity "John Smith" -SearchQuery subject:"TEST" -TargetMailbox admin@contoso.com -TargetFolder SearchResult -LogOnly -LogLevel Full

To copy found message just remove -LogOnly and – LogLevel switches. To delete message without making its copy run above command without -TargetMailbox and -TargetFolder switches and add -DeleteContent at the end:

Search-Mailbox -Identity "John Smith" -SearchQuery subject:"TEST" -DeleteContent

There is more options to search for a specific email using different criteria, like sender email address or name, date that message was sent etc. For more examples go to: http://help.outlook.com/en-GB/140/gg315525.aspx