none
is it possible to set a delay to messages in an Exchange Server 2007/2010 transport agent? RRS feed

  • Question

  • Hi,

    I'm developing an Exchange Server 2007/2010 transport agent and like to set a certain time on certain messages when they are to be delivered.
    Some kind of delay time would also do it.

    The goal is to get some messages only being delivered within certain time spans.

    Is there any way to do this within a transportagent?

    I started discussing this issue at: http://social.microsoft.com/Forums/en-US/partnerdevvs/thread/948ee8f9-1fe9-4e0e-8fd4-7c7c3485bc46/

    And I was pointed to this forum.

    Ranger suggested to use the Defer method:

    "Commonly the deferred delivery option is totally handled by client application like Outlook. Once the mail item is sent to server and has run into the transportation lifecycle, it will be sent out ASAP in order to reduce the server's workload. That's why the Outlook client object MailItem has the DeferredDeliveryTime Property but Microsoft.Exchange.Data.Transport.MailItem Class  hasn't.

    If the performance impact could be ignored regarding to your business requirement, I suggest that you can try to use the Defer Method for a message.

    During OnSubmittedMessage event of a transportation agent, we can access the SubmittedMessageEventHandler Delegate:

    public delegate void SubmittedMessageEventHandler (

                   SubmittedMessageEventSource source,

                   QueuedMessageEventArgs e

    )

    The first parameter of this event handler is an instance of  SubmittedMessageEventSource Class. This class has a Defer Method where we can set the TimeSpan about how long the processing could be deferred."

    The Defer Method sounds really good for my purpose (I didn't know/find that method before), but there is one thing in its description I'm worying about:

    "The Defer methodreverts the contents of the current MailItem to the original contents that existed when the message was committed to the queue."


    Does this mean changes my transport agent applies to the message will be ignored? 
    - Which changes only changed before I call Defer or any changes (inlcuding those after the Defer call)?


    Best regards,
     
    Harald Binkle


    Exchange Server Toolbox | SmartPOP2Exchange | SpamAssassin
    JAM Software GmbH
    Max-Planck-Str.22 * 54296 Trier * Germany
    http://www.jam-software.com

    Tuesday, April 24, 2012 11:01 AM

All replies

  • Harald,

    Yes defer is like a boomerang with timer and yes it does revert but is that a problem ? Surely you can look at the email and say "hmmm .. don't want to let that go through for 3 hours" and defer it .. and when it comes back you just let it though ?

    Regards,


    Scott Quinn | C# developer & messaging specialist (for hire). Contact me at http://au.linkedin.com/in/scottquinn

    Tuesday, April 24, 2012 12:43 PM
  • Hello Scott,
    Thanks for your answer. 
    Yes if it reverts changes and does not accept changes I need to know. I'd like to implement more actions which can be applied to messages.
    If the revert also mean that the message does not accept any changes after calling Defer in the agent event I need to ensure no actions to be done before AND after the call. 
    When I understant you correctly I can do other changes to the message later on when the message triggers the OnSubmitted event again, right?


    Best regards,
     
    Harald Binkle


    Exchange Server Toolbox | SmartPOP2Exchange | SpamAssassin
    JAM Software GmbH
    Max-Planck-Str.22 * 54296 Trier * Germany
    http://www.jam-software.com

    Tuesday, April 24, 2012 3:21 PM
  • Sure - when the messages "returns" it's no different to a new message - you can make changes.

    Regards,


    Scott Quinn | C# developer & messaging specialist (for hire). Contact me at http://au.linkedin.com/in/scottquinn

    Tuesday, April 24, 2012 4:07 PM