Office 365 and Exchange 2007 Mail Flow Issue for Sub Domain

I have recently had an Office 365 and Exchange 2007 Mail Flow Issue for Sub Domain. We have our primary users on user.name@domain.com and have setup Office 365 to process mail for user.name@sub.domain.com .

The setup for Office 365 went extremely smoothly (with a lot of help from a friend – you know who you are J.P.) and I have integrated Office 365 with our on-premise Active Directory using ADFS and Synchronization Service Manager for Single Sign On.

However when a user, user.name@domain.com tried to send an email to user.name@sub.domain.com using the on-premise Exchange 2007 the mail was not delivered.

User user.name@sub.domain.com could send email to user.name@domain.com without any problems, but again a reply from user.name@domain.com was not delivered.

I investigated further on the Exchange 2007 Server and found that in Queue viewer there was an Unreachable Domain queue with emails which could not be delivered.

The error message displayed was “The mailbox recipient does not have a mailbox database”.

Office 365 – Queue Viewer

I tried a few things to try to rectify this;

I added an additional Accepted Domain for sub.domain.com – this did not work.

I added an additional send connector for sub.domain.com – this did not work.

I checked in Active Directory Users and Computers that the Email field was set to user.name@sub.domain.com – it was set and this did not work.

I used ADSI Edit to check the proxyAddresses attribute included SMTP:user.name@sub.domain.com – the upper case SMTP indicates this is the primary email address – this did not work.

” targetAddress – In contacts and mail-enabled users this attribute contains the type and address of the mailbox represented by the recipient. This will point to a mailbox outside the Exchange organization, for example, to a hotmail account or to another’s company address. On the ‘Users and Computers’ snap-in, this property is edited on the ‘Exchange General’ page of contacts and mail-enabled users.”

I checked out the targetAddress attribute using ADSI Edit and added the user.name@sub.domain.com and this worked.

Office 365 – targetAddress

What is basically happening is that the Exchange 2007 Server sees the targetAddress attribute is populated with a non Accepted Domain and therefore treats it as an external address and simply passes it out through the relevant Send Connector.