Search code examples
c#emailexchange-serverexchange-server-2010exchange-transport-agents

Exchange Transport Agent Bounce MailItem


In our Exchange RoutingAgent, we would like to be able to bounce an email back to the sender in the event of an unexpected exception. We would also like to be able to send the bounce message to some pre-defined admin email too if possible. Is there any way to bounce a message in the OnSubmittedMessage or the OnResolvedMessage events? I am hoping there is some method in the Exchange libraries to easily achieve this, or is there some way to create a new MailItem and send it to the original sender and possibly an admin?


Solution

  • You need to generate a new message to do that there is a sample for this on https://blogs.msdn.microsoft.com/mstehle/2010/03/10/howto-return-to-sender-transport-agent-sample/

    You should also be able to use https://msdn.microsoft.com/en-us/library/jj976002(v=exchg.150).aspx

    Cheers Glen