我在Outlook 2010中有两个邮箱帐户。
每次收到help@something.com的新邮件,我都会收到新邮件的信封。
我只想收到Bob@something.com的信封
我取消了在Outlook中接收信封的选项。
我使用Bob@something.com
帐户在Outlook 2010中创建了一条规则我可以选择运行脚本,但它是空的。
我需要编写可以执行此操作的VBA代码:
If (mail was send to Bob@something.com) Then
show Envelope
End If
我知道我可以添加help@something.com文件夹而不是其帐户,但在我的环境中无法实现(云用户)。
我在网上搜索过但没有找到这样的东西。例如,我没有找到可以在Windows中打开信封的代码行。
答案 0 :(得分:0)
如果您发现显示消息框是可接受的替代方案,则此处描述了运行脚本格式Outlook's Rules and Alerts: Run a Script
从规则中,您将新邮件作为“项目”传递,如下所示:
Public Sub DisplayMessageBox(Item As Outlook.MailItem)
' You need not do anything with "Item" just use it as a trigger
MsgBox "New mail in Bob@something.com"
' or you can enhance the message using "Item" properties
MsgBox "New mail in Bob@something.com - Subject: " & Item.Subject
End Sub
您可能还会考虑更复杂的ItemAdd或NewMailEx。
这里有一个ItemAdd示例How do I trigger a macro to run after a new mail is received in Outlook?