locked
Inpect and block outgoing emails. RRS feed

  • Question

  • Hello, I am new in Exchange Server Development. My task is to create TransportAgent that can inspect and sometimes block outgoing emails. It is important for me to inspect and block internal emails too(not only emails going out of organization). I need to support Exchange 2010, 2013.

    Thanks in advance,

    Vitaly

    Sunday, January 12, 2014 1:56 PM

Answers

All replies

  • Normally these things are taken care by third party anti spam applications.
    What kind of email you are looking to block and allow?

    Cheers,

    Gulab Prasad,

    Technology Consultant

    Blog: www.exchangeranger.com  Twitter:    LinkedIn:   
    Check out CodeTwo’s tools for Exchange admins   

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Sunday, January 12, 2014 2:16 PM
  • I want to block emails according to the email content
    Sunday, January 12, 2014 4:57 PM
  • By keyword for example? In subject line or body of text?

    I think simple Transport Rules might allow this.


    Please mark as helpful if you find my contribution useful or as an answer if it does answer your question. That will encourage me - and others - to take time out to help you.

    Sunday, January 12, 2014 9:17 PM
  • Transport Rule is the Answer of your question.

    Cheers,

    Gulab Prasad,

    Technology Consultant

    Blog: www.exchangeranger.com  Twitter:    LinkedIn:   
    Check out CodeTwo’s tools for Exchange admins   

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Monday, January 13, 2014 3:17 AM
  • As others have mentioned probably what you want can be done via Transport Rules.

    However if you have some form of content that can't be caught with Rules and you want to use a Transport Agent then.

    >> It is important for me to inspect and block internal emails too(not only emails going out of organization). I need to support Exchange 2010, 2013.

      Then using a routing agent http://msdn.microsoft.com/en-us/library/office/aa563310(v=exchg.150).aspx (the OnSubmittedMessage is probably the most appropriate) and http://msdn.microsoft.com/en-us/library/office/aa579261(v=exchg.150).aspx#Namespaces is the way to go as this will catch both Internal and External email. If you want to write one agent that will work on both 2010 and 2013 then you want compile with the 2010 binaries and then use the http://technet.microsoft.com/en-us/library/jj591524(v=exchg.150).aspx on 2013 (or just compile a different version for 2010 and 2013).

    Cheers
    Glen

    • Marked as answer by VitalyArt Monday, January 13, 2014 9:23 AM
    Monday, January 13, 2014 3:32 AM
  • Thank you very much
    Monday, January 13, 2014 9:23 AM
  • Hi,

    I have additional question about it.

    Does the proposed solution( routing agent ) will work for mobile devices clients?

    I mean that I want also inspect and block emails(according to the email content ) that synchronized to mobile devices using ActiveSync protocol?

    Saturday, January 18, 2014 1:14 PM
  • Yes, it will work...

    Cheers,

    Gulab Prasad

    Technology Consultant

    Blog: http://www.exchangeranger.com    Twitter:   LinkedIn:
       Check out CodeTwo’s tools for Exchange admins

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Saturday, January 18, 2014 1:18 PM
  • Thank you,

    another two questions:

    1. How can I block email in the Routing Agent? For example I will implement (as suggested) OnSubmittedMessage callback. What should I do in my code to block email after I inspect it content?

    2. Can I get some indication in the OnSubmittedMessage callback that this specific email is sent as a result of ActiveSync synchronization request?

    Thanks

    Saturday, January 18, 2014 1:46 PM
  • 1. If you want to block the email you need to use one of the SubmittedMessageEventSource method http://msdn.microsoft.com/en-us/library/microsoft.exchange.data.transport.routing.submittedmessageeventsource_members(v=exchg.80).aspx

    eg Calling Delete will delete the Message with no NDR's, if you want an example of using this and creating you own custom NDR see http://blogs.msdn.com/b/mstehle/archive/2010/03/10/howto-return-to-sender-transport-agent-sample.aspx

    2. ActiveSync has nothing to do with Transport Agents. A Transport Agent lets you intercept a message while its in the Transport pipeline and before it is delivered to a Mailbox. ActiveSync is just a Mailbox Access\Sync API for mobile devices. So if your trying to stop particular email content syncing to devices blocking them with a Transport Agent will work but only as much that it will block the email from ever being received by the Mailbox.

    Cheers
    Glen

     
    • Marked as answer by VitalyArt Monday, January 20, 2014 3:17 PM
    Sunday, January 19, 2014 10:13 PM
  • Thank you
    Monday, January 20, 2014 3:17 PM