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?
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.
NewMailEx
Application
See Walkthrough: Create your first VSTO Add-in for Outlook to get started quickly.
2.1m questions
2.1m answers
60 comments
57.0k users