When you are creating a hosted Exchange system using the Exchange 2010 On Premises product (not the /hosting version of the product) it is likely that if two or more of your customers create a mail contact in the global address list (GAL) for the same external email recipient they will see some issues with email addressing.
For example, you are hosting Exchange for northwind.com and fineartschool.net within one Exchange organization. Both these companies have a professional relationship with email@example.com and so want to create a contact for him in the GAL. The first of your clients to create the contact will be successful, but any future client receives the following error when they attempt to create the contact:
New-MailContact -Name “Greg (Fabrikam)” -ExternalEmailAddress firstname.lastname@example.org -OrganizationalUnit FineArtSchool
The proxy address “SMTP:email@example.com” is already being used by “isp.corp/Hosted/Northwind/Greg (Fabrikam)”. Please choose another proxy address.
+ CategoryInfo : NotSpecified: (…) :ADObjectId) [New-MailContact], ProxyAddressExistsException
+ FullyQualifiedErrorId : B333D21C,Microsoft.Exchange.Management.Recipient
The work around is to specify a unique proxy address, as the default proxy address (the contacts actual email address) is already being used:
New-MailContact -Name “Greg (Fabrikam)” -ExternalEmailAddress firstname.lastname@example.org -OrganizationalUnit FineArtSchool -PrimarySmtpAddress email@example.com
Of course Greg’s email address is firstname.lastname@example.org (his external email address) and not email@example.com (his proxy or primary SMTP address so far as Fine Art School have configured) and if this client sends an email to Greg and they select Greg from the GAL it will go to his external email address but will look like it has gone to his proxy address. That is, Greg will receive the email but if he looks at the address it was sent to it will say firstname.lastname@example.org.
Send an email to two people in external organizations, one being email@example.com, and hit Reply All and Greg will appear as greg@proxyaddress and not firstname.lastname@example.org. Emails in reply will go to Greg via the hosting company and not direct to Greg. This also has the side affect of showing presence (from Microsoft Lync) as being unavailable as the email is using the wrong email address.
The underlying problem is that though the email is being delivered to the external address (targetAddress attribute in Active Directory) it is being stamped with the primary SMTP address (proxyAddresses in Active Directory) in the P2 header. The P2 header is used to generate the Reply address.
So how do you fix this? The obvious way at first glance is to modify active directory and change the proxyAddresses value back to the correct value – but this does not work (as two objects cannot have the same proxy address). Regardless of the fact that the two mail contacts both have the same targetAddress and proxyAddresses, Exchange Transport detects a problem and reports the error “More than one Active Directory object is configured with the recipient address email@example.com. Messages to this recipient will be deferred until the configuration is corrected in Active Directory” in the event log on the first Hub Transport server that sees the message.
So without writing your own transport agent, you need to route all outbound email via an Edge Transport server and configure the Address Rewriting agent. You need to create an address rewrite rule for every contact that is created within your hosted organization once the second contact is created. So in your mail contact provisioning application you need to trap the duplicate proxy address error above, reissue the mail contact creation step, this time with a unique primary SMTP address in the hosted clients domain and then at the same time make an address rewrite rule on your Edge Transport server.
Note that rewrite rules are cached for four hours, so unless you restart the MSExchangeTransport service your rewrite rules will not take effect until four hours have gone by.