There will be times when you find the options available in the console when creating a new email address policy are not suitable for your particular scenario. In those cases you can use the Exchange Management Shell to create a more specific filter for the email address policy.
Email address policies are created using the New-EmailAddressPolicy cmdlet. This cmdlet has a -RecipientFilter parameter for defining the scope of your email address policies.
So let’s look at one example of creating an email address policy in PowerShell using the capabilities of -RecipientFilter.
Now I’ll create the email address policy, using a recipient filter that checks display names for the string “(%m@India.com)”. The new policy will have the following properties:
- A name of “Sales”
- A priority of 3
- An email address template of “SMTP: %m@India.com” (the upper-case SMTP defines the primary SMTP address, lower-case would be a secondary SMTP address)
- A recipient filter for the DisplayName attribute of “*(Sales)” (the * is a wildcard)
Running that as a command in the Exchange Management Shell looks like this:
Now the new email address policy has been created, but as before it has not yet applied to any recipients. To trigger the policy for the three Sales users I’m going to modify their display names to append “(Sales) to them. I’m just doing them individually here but you could script it if you had a lot of mailbox users to modify.
Jo now has the @India.com SMTP address assigned by the new policy.
Hopefully this SOP has provided you a good understanding of how email address policies work in Exchange Server 2010, and given you some ideas on how you can use them in your own Exchange organization.