Reputation: 714
I am looking for cmdlet which would allow me to search and fetch email body/to/from
information. Currently I am using Search-Mailbox
but I am getting only the resultItemCount
. Any idea how to get actual body via cmdlet?
Upvotes: 0
Views: 3444
Reputation: 71
If you use exchange online powershell.
You can identify emails for the past 48 hours ( up to ten days if you specify start and end date).
$messages = Get-MessageTrace -SenderAddress [email protected] -StartDate 03/21/2021 -Enddate 03/31/2021
Get-message -messageId $messages[1].messageid
Will return the message from the first one on the list that is returned.
For more info, check out this documentation from microsoftdocs.
https://learn.microsoft.com/en-us/powershell/module/exchange/get-message?view=exchange-ps
Upvotes: 1
Reputation: 326
Are you an exchange admin?? If you are, or have access to exchange admin credentials, I would check out this tool (which is used by hackers to search email) called MailSniper https://github.com/dafthack/MailSniper It is technically for pentesting... but if you wanted to search your emails for body content this would work.
It's a powershell module, pretty easy to use, just download it, go to that directory in powershell, import the module, and start running the commands. For what you are looking for, some commands to look at are:
Upvotes: 0