Export Mail Addresses with specific email subject in exchange server 2019

Rubiat Rafi 16 Reputation points
2024-02-05T06:31:31.04+00:00

Hello, Someone from outside sent a mail to 500 of users of our environment. Now I want to find out the list of 500 mailboxes who got the mail. Now how can I find out it by exchange management shell. I need Mail Address, Received Event and Subject. Please provide me the command. For example: The mail subject is "Test" and ******@domain.com and ******@domain.com received the mail and also deleted the email from ******@domain.com. Now I want to run a command with the subject where the mail is currently exist and then output should be @domain.com@domain.com

Exchange Server
Exchange Server
A family of Microsoft client/server messaging and collaboration software.
1,448 questions
Exchange Server Management
Exchange Server Management
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Management: The act or process of organizing, handling, directing or controlling something.
7,825 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,864 questions
0 comments No comments
{count} vote

2 answers

Sort by: Most helpful
  1. Kael Yao-MSFT 37,711 Reputation points Microsoft External Staff
    2024-02-05T07:35:58.43+00:00

    Hi @Rubiat Rafi

    Please first assign the Mailbox Import Export role to the admin account you are using in Exchange Admin Center>permissions>admin Roles.

    Then run this cmdlet in Exchange Management Shell to search all mailboxes for this email and export the result to a mailbox you specify (in the following example the search result will be sent to admin's inbox folder):

    Get-Mailbox -ResultSize Unlimited | Search-Mailbox -SearchQuery "Subject:Test" -TargetMailbox "admin" -TargetFolder "inbox" -LogOnly -LogLevel Full
    

    Once the search completes, you will receive an email like: 01


    In the csv file you will see results like: 02


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".  Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.