none
Exchange Transport Agent type RRS feed

  • Question

  • 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

    Monday, July 20, 2015 6:34 PM

All replies

  • 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

    Tuesday, July 21, 2015 3:53 AM
  • 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.

    Tuesday, July 21, 2015 2:25 PM
  • 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

    Wednesday, July 22, 2015 4:29 AM
  • Hi Glen,

    Thanks a lot for detail explanation and pointing to the sample

    Friday, July 24, 2015 1:25 PM