Outlook Application_NewMailEx无法启动 [英] Outlook Application_NewMailEx not working on startup

查看:138
本文介绍了Outlook Application_NewMailEx无法启动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Application_NewMailEx处理收到的所有电子邮件. 它在打开Outlook时收到的电子邮件上正常工作.

I am using a Application_NewMailEx to treat all emails received. It works fine on emails received while Outlook is open.

但是,启动时,接收到的电子邮件不会呼叫Application_NewMailEx.

However on startup, the Application_NewMailEx does not get called by received emails.

我尝试使用Application_Startup,但是在收到电子邮件之前调用了它==>不起作用. 没有application.ontime来延迟启动宏... Application_NewMail也是一样.

I tried using a Application_Startup but it is called before emails are received ==> does not work. There is no application.ontime to delay the startup macro... Application_NewMail does the same.

怎么办?

Private Sub Application_NewMailEx(ByVal EntryIDCollection As String)
    INIT_FOLD
    TreatMsg Application.GetNamespace("MAPI").GetItemFromID(EntryIDCollection)
End Sub

推荐答案

NewMailEx事件仅对代码在运行时收到的消息触发.在此之前,不会触发您在(Exchange?)邮箱中收到的电子邮件.

NewMailEx event will fire only for the messages received while your code was running. It will not fire for the emails received in your (Exchange?) mailbox before that.

您可以在启动时(Items.RestrictItems.Find/FindNext)处理收件箱中的未读电子邮件,假设新的未处理邮件仍然未读,或者(在缓存模式下)在收件箱文件夹中使用Items.ItemAdd事件-当您的OST文件与远程邮箱同步时,它将触发.

You can either process the unread emails in the Inbox on startup (Items.Restrict or Items.Find/FindNext) assuming that new unprocessed messages are still unread or (in case of cached mode) use Items.ItemAdd event on the Inbox folder - it will fire when your OST file is being synchronized with the remote mailbox.

这篇关于Outlook Application_NewMailEx无法启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆