Exchange Transport Agent type

Can someone please explain the following thing to me? 

1. When should I write SmtpReceiveAgent and when should I write RoutingAgent

2. How can I control the email flow in Transport Agent?  Such as, reject email delivery, accept email delivery, and discard email delivery. Is it possible to do the above actions in both SmtpReceiveAgent and RoutingAgent?

Thanks

July 20th, 2015 2:35pm

1.

SMTPAgent can be used to process email this is sent or received via SMTP, the most obvious example is an Edge server in Exchange where by design all Email that traverses this type of server will be sent or received via SMTP. Other examples would be something like an RBL list where your processing the SMTP headers to determine if you want to accept delivery of a message.

RoutingAgents can be used to process any mail that is processed by a Hub Server eg a Message that is sent internally between two users on the same server will still traverse a Hub server but because there is no requirement for it the email will never be converted to SMTP so in this instance a Routing Agent would fire but a SMTPAgent wouldn't. 

see https://technet.microsoft.com/en-us/library/bb125012(v=exchg.141).aspx

2.

>> How can I control the email flow in Transport Agent?  Such as, reject email delivery, accept email delivery, and discard email delivery.

Yes and No you can do all the above but you need to give more context I would suggest you start with the Transport Agent samples https://msdn.microsoft.com/en-us/library/office/dd877105(v=exchg.150).aspx . Then ask more a detailed question around what your attempting to do if you have a question around a specific thing eg particular things like RBL's would only ever be valid for SMTPReceiveAgents.

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
July 20th, 2015 11:55pm

Hi Glen,

Thank you so much for the detail explanation. It clears many things to me. I went through the sample code before but was confused between SmtpReceiveAgent & RoutingAgent. Your explanation cleared that things for me.

Regarding the email control, what I want to achieve is as follows:

1. Intercept the email using TransportAgent and based on some conditions, I would like to accept the email, so that it will sent normally or reject the email so that it won't deliver the email. Can I do it in RoutingAgent or I need SmtpReceiveAgent? Mail can come from internal server (same domain) as well outside SMTP server (different domain)

Thanks again for your time to answer my question.

July 21st, 2015 10:27am

1. If you need to intercept messages that are being sent between Internal users within your Exchange Organization then use a Router Agent. A router Agent will fire on all messages that traverse the hub server where it is installed (regardless of the source eg Internal or External so don't worry about using a SMTPReceiveAgent). (if you have multiple Hubs then you need to install it on all hub servers)

I would use OnSubmitted Message https://msdn.microsoft.com/en-us/library/microsoft.exchange.data.transport.routing.routingagent.onsubmittedmessage(v=exchg.150).aspx this means you get the message before any other processing is done on it eg if a message is being sent to a Distribution list you get it pre expansion etc. There is a sample router agent that rejects a message and provides a custom NDR http://blogs.msdn.com/b/mstehle/archive/2010/03/10/howto-return-to-sender-transport-agent-sample.aspx

Cheers
Glen

Free Windows Admin Tool Kit Click here and download it now
July 22nd, 2015 12:31am

Hi Glen,

Thanks a lot for detail explanation and pointing to the sample

July 24th, 2015 9:27am

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

Other recent topics Other recent topics