Issue: how to delete email using Transport rule on Exchange 2010?
Sometime you use to get Spam email from external domain and same Spam spread across your internal network. Then you have block and delete those spam thread. You can do the same using exchange transport rule.
Follow the below steps to block and delete Spam email.
1. Log on to the Exchange Server using Organization Management group permission.
2. Open Exchange Management Console > expand 'Organization Configuration' > Click on 'Hub Transport' > then Click 'New Transport Rule'.
Type 'Name' and 'Comment' and make sure that check mark the 'Enable Rule' and click on next. see the attached screenshot.
3. On Conditions page, select the appropriate condition. If you want to block and delete on basis of "Subject line" then select only subject like, 'When the subject field contains specific words.' and 'delete the message without notifying anyone'.
Now you need to click on 'specific words' and then specify the Spam word. e.g. “Spam email" and add the same and Click on 'OK'. See the screenshot for more information. Now click on 'Next>'.
4. Click on "Next >".
5. Click on "New".
5. Finally click on "Finish".
6. Now you will see the newly created rule. I.e. Spam Block.
7. Right click on newly created rule and change the rule priority to "0". So that it will take effect on high priority and do the defined job.
You may need to delete already delivered email from users mailbox.Script to delete the delivered email from Mailbox:
1. Delete delivered messages from single mailbox.
Get-Mailbox -Identity email@example.com| Search-Mailbox -SearchQuery 'Subject:"Spam email"' –DeleteContent
2. Delete delivered messages from all mailbox:
Get-Mailbox | Search-Mailbox -SearchQuery 'Subject:"Spam email"' –DeleteContent