RoutingDomainOverride with custom transport agent

I've wrote a custom transport agent that overrides the routing of the FROM user to make it go to specific send connectors. The reason is because there are certain people I want going out specific send connectors for smart host options such as email archiving/encryption.

Now the problem I'm facing is when I do this with a smart host it works great! But if I remove the smart host and let Exchange do DNS lookups then it will **sometimes** get the 5.4.4 NonExistent Domain errors.

So I have a send connector with the address space set to "custom-domain1xyz.com" which is just a fake domain we use for one send connector. I override the messages which force it to go out that send connector. My guess is Exchange is looking up the custom-domain1xyz.com instead of doing an actual lookup on the receipient domain.

This is the override code in C# for OnResolvedMessage event:

foreach (var recipient in e.MailItem.Recipients)
 {
    RoutingDomain newRoutingDomain = new RoutingDomain("custom-domain1xyz.com");
    RoutingOverride newRoutingOverride = new RoutingOverride(newRoutingDomain, 0);
    source.SetRoutingOverride(recipient, newRoutingOverride);
}

The value 0 should be UseOverrideDomain: https://msdn.microsoft.com/en-us/library/office/microsoft.exchange.data.transport.deliveryqueuedomain(v=exchg.150).aspx

Here is the override method:

https://msdn.microsoft.com/en-us/library/office/dd899758(v=exchg.150).aspx


July 2nd, 2015 4:12pm

The exchange send connector address space part will try to do a dns lookup for that specified domain since it needs to deliver this message to the next hop.

So if you are specifying "custom-domain1xyz.com" then it should have a registered hostname and an ip address

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 6:48am

I would suggest you enable Pipeline tracing https://technet.microsoft.com/en-us/library/bb125018(v=exchg.150).aspx that should at least tell you exactly what's happening when it does go wrong.

Cheers
Glen

July 3rd, 2015 6:51am

I can see what is happening and that is Exchange is trying to send the email to the MX records for the domain custom-domain1xyz.com.

If you are using a smart host the smart host somehow knows that it should process the recipient domains and it functions correctly but Exchange seems to ignore the email addresses actually stamped on each recipient.

I'm 'guessing' that since the address space is set to custom-domain1xyz.com it just assumes everything hitting that send connector is supposed to go to the MX records for custom-domain1xyz.com. If thats the case what is the point of the routingdomainoverride feature because it doesn't work without a smart host.

Free Windows Admin Tool Kit Click here and download it now
July 3rd, 2015 8:55am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics