Block incoming emails in Outlook

  • Thread starter Thread starter Unni
  • Start date Start date
U

Unni

Hi,
I need to block incoming emails (basically SendAndReceive operation) in
Outlook for a specified duration(say 1 minute).
I need to do this programmatically in C#/C++.

Please help me..


Thanks in advance
Unni
 
Block in what way? You can handle NewMail() or NewMailEx() or ItemAdd() on
the Inbox and do something, but you can't prevent new mails from coming in
at all. You can handle item.Send() or Application.ItemSend() and cancel
send's but you can't prevent them from taking place at all.

You can also handle events for SyncObjects and cancel any that are
user-started, but you don't get anything when an automatic send/receive is
started. Of course you can handle these events only if you are supporting an
Outlook version that exposes them, which you never mention.
 
Hi Ken Slovak,

thank you for the reply.
I need to do this in outlook version above 2003.
I need to stop automatic fetching of incoming mails for some minutes.

In Oultook tools menu -> Send/Receive->Send/Receive Settings -> Then
Defining the settings, we can uncheck an option to 'Schedule an automatic
send/receive every xx minutes.'

Is it possible to uncheck this option programmatically. This would be also
helpful

Thanks
Unni
 
You can change that setting in the registry, but Outlook will only read it
at startup. It won't read it again, after startup it keeps that along with
many other settings in an in-memory cache. I don't believe you will be able
to do what you want.
 
Back
Top