为Outlook规则编写脚本 [英] writing a script for Outlook rules

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

问题描述

你好

自从我使用VBA以来已经很多年了 - 所以非常生锈 - 而且我从来没有使用过OutlookVBA。我希望,我想做的事情应该非常简单,但我不知道如何开始。

It's been a number of years since I used VBA— so— very rusty— and I've never used OutlookVBA at all. What I want to do should be very simple, I hope, but I don't know how to start.

我想写一条规则用于各种邮寄者,主要是零售商,谁不断发送邮件。 90%是垃圾,但我不想自动删除,因为偶尔我会买东西,并且需要看到我收到的消息 - 收到
等等。我也不能做出删除异常,因为消息的措辞和格式会从一个零售商到另一个零售商发生根本变化。

I want to write a rule to use for various mailers, mostly retailers, who are constantly sending mail. 90% is junk, but I don't want to automatically delete because occasionally I do buy something, and need to see the messages that follow when I do— receipts and so forth. Nor can I make a delete-exception, because the wording and format of the message will vary radically from one retailer to another.

我希望这条消息能够触发这样的对话框:"来自______的邮件"  (空格应填写发件人姓名,"Lehmans",例如)

- 后跟复选框:"delete?","open?"或" ;保存?"

如果它需要是/或为了保持简单,我可以在没有"开放"的情况下生活吗?选项。

I'd like the message to trigger a dialog something like this: "Mail from ______ "  (The blank should be filled in with the sender's name, "Lehmans," for example)
—followed by checkboxes: "delete?", "open?", or "save?"
If it needs to be an either/or to keep it simple, I can live without the "open?" option.

这是否很简单,我认为它应该是?任何人都可以提供帮助,或者指出我已经解决了这个方向吗?

is this is simple as a I think it should be? Can anyone help, or point me in a direction where this has already been addressed?

谢谢

-Nick

推荐答案

Hello Nick,

Hello Nick,

你可以处理
NewMailEx
在收件箱中收到新项目时触发的应用程序类的事件

You can handle the NewMailEx event of the Application class which is fired when a new item is received in the Inbox.

<当新邮件到达收件箱时,会触发>  NewMailEx   事件并在客户端规则处理发生之前。您可以使用  EntryIDCollection   中返回的条目ID数组
来调用 
NameSpace.GetItemFromID   方法和流程
项目。请谨慎使用此方法,以尽量减少对Outlook性能的影响。但是,根据客户端计算机上的设置,在新邮件到达收件箱后,垃圾邮件过滤和将新邮件
从收件箱移动到另一个文件夹的客户端规则等过程可能会异步发生。您不应该假设在这些事件触发后,您将始终获得收件箱中项目数量的一项增加。

The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item. Use this method with caution to minimize the impact on Outlook performance. However, depending on the setup on the client computer, after a new message arrives in the Inbox, processes like spam filtering and client rules that move the new message from the Inbox to another folder can occur asynchronously. You should not assume that after these events fire, you will always get a one-item increase in the number of items in the Inbox.

因此,您可以检查收到的项目一进入收件箱并决定是否显示对话框。

So, you can check the received item as soon as it comes to your Inbox and decide whether to show a dialog box or not.

最后,您可能会找到
Outlook 2010中的VBA入门
文章很有帮助。

Finally, you may find the Getting Started with VBA in Outlook 2010 article helpful.


这篇关于为Outlook规则编写脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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