0
votes

Using Outlook 2013 in Win10.

I've read several postings here on this Q & A and on forums about using 'MailItem.DeferredDeliveryTime' to delay sending for a number of seconds. I wrote code to delay messages for 30 seconds.

I decided to watch the Outlook outbox and my system clock, and the delay was not 30 seconds but rather the nearest full minute. In other words, if I sent the mail at 10:00:05, instead of waiting 30 seconds, it would wait 55 seconds. If I sent the mail at 10:00:55, instead of waiting 30 seconds, it would wait 5 seconds.

The code in my ItemSend event handler:

Item.DeferredDeliveryTime = DateAdd("s", 30, Now)
Debug.Print Format(Now, "hh:mm:ss"), Format(Item.DeferredDeliveryTime, "hh:mm:ss"), Format(DateAdd("s", 30, Now), "hh:mm:ss")

The Immediate window shows the following:

10:36:10 10:37:00 10:36:40

which is the current time, the time saved in DeferredDeliveryTime, and the time I was trying to set.

I think this confirms that DeferredDeliveryTime is rounding to the nearest minute.

Is there a way to get 'DeferredDeliveryTime to accept seconds?

1

1 Answers

0
votes

All DateTime properties (even the ones retrieved from MailItem.PropertyAccessor.GetPropety) are rounded to the nearest minute. AFAIK that code always goes through something that is also used to display time in the UI, where it is always rounded.

You can use Extended MAPI (C++ or Delphi) or Redemption (any language) if you want a better precision.