问题
Is there anyway you can create a code, when you click a button (I've already created this) it will take the selected email and block the sender which will delete the email?
回答1:
Outlook Object Model does not expose blocked/safe senders at all.
If using Redemption is an option, it exposes RDOJunkEmailOptions object (returned from RDOSession.JunkEmailOptions
, RDOAccount.JunkEmailOptions
, RDOExchangeMailboxStore.JunkEmailOptions
), which allows to add blocked senders using RDOJunkEmailOptions.BlockedSenders.Add
.
回答2:
The Outlook object model doesn't provide anything for that. However you can create a VSTO add-in which can handle incoming emails and delete them is the sender belongs to a blocked list. The NewMailEx
event of the Application
class is fired 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.
See Walkthrough: Create your first VSTO Add-in for Outlook to get started quickly.
来源:https://stackoverflow.com/questions/50954108/block-email-sender