Block Outbound Emails for a Group of Users
Request was to block all Exchange Admins accounts from sending out external emails.
This can be done easily with a Transport Rule:
Create a Distribution Group and add all the Exchange Admin accounts that you want to block: ExAdmins@e2k10.local
Start the New Transport Rule Wizard
Give the New Transport Rule a Name: "Block Exchange Admins External Email
For the Conditions select "From a member of distribution list"
Select the Distribution Group you just created for the ExAdmins
Also under Conditions select:
"from users that are inside or outside the organization" - Inside the Organization
"sent to users that are inside or outside the organization" - Outside the Organization
For Actions select "send rejection message to sender with enhanced status code"
Message: External Email Blocked
Status code: 5.7.1
Complete the wizard and create the rule
If you don't want to use the New Transport Rule wizard you can just edit and run the following command:
New-TransportRule -Name 'Block Exchange Admins External Email' -Comments '' -Priority '0' -Enabled $true -FromMemberOf 'ExAdmins@e2k10.local' -FromScope InOrganization -SentToScope 'NotInOrganization' -RejectMessageReasonText 'External Email Blocked' -RejectMessageEnhancedStatusCode '5.7.1'