How to block outgoing emails to a specific address in Outlook?
Generally speaking, Outlook sends emails to all normal email addresses, and can’t block sending emails to a specific email address. But, sometimes, you may need to prevent sending emails to a specific email address in Outlook. In this case, this tutorial will introduce a VBA code for solving this task.
The following VBA code can do you a favor, please do as this:
1. Launch the Outlook, then, hold down ALT + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Then, double click ThisOutlookSession from the Project-Project1 pane, and then, copy and paste the below code into the blank code window:
VBA code: Block outgoing emails to a specific address
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) 'Updatby ExtendOffice Dim xMail As Outlook.MailItem Dim xRecipients As Outlook.Recipients Dim xContactGroupFound As Boolean Dim i, n As Long Dim xRecipient As Outlook.Recipient Dim xAddress As String Const PR_SMTP_ADDRESS As String = "http://schemas.microsoft.com/mapi/proptag/0x39FE001E" On Error Resume Next If Item.Class <> olMail Then Exit Sub Set xMail = Item xContactGroupFound = True Do While xContactGroupFound = True Set xRecipients = xMail.Recipients xContactGroupFound = False For i = xRecipients.Count To 1 Step -1 If xRecipients(i).AddressEntry.DisplayType <> olUser Then For n = 1 To xRecipients(i).AddressEntry.Members.Count If xRecipients(i).AddressEntry.Members.Item(n).DisplayType = olUser Then xMail.Recipients.Add (xRecipients(i).AddressEntry.Members.Item(n).Address) Else xMail.Recipients.Add (xRecipients(i).AddressEntry.Members.Item(n).Name) xContactGroupFound = True End If Next xRecipients(i).Delete End If Next i xRecipients.ResolveAll Loop For Each xRecipient In xRecipients xAddress = xRecipient.PropertyAccessor.GetProperty(PR_SMTP_ADDRESS) If VBA.Trim(xAddress) = "" Then xAddress = xRecipient.Address End If If xAddress = "" Then 'change this email address to your need If MsgBox("Do you want to email to " & Chr(34) & xAddress & Chr(34) & "?", vbExclamation + vbYesNo, "Kutools for Outlook") = vbNo Then xRecipient.Delete End If End If Next If xMail.Recipients.Count = 0 Then Cancel = True End If End Sub
3. Then, save and close this code window. Now, when sending an email, if the specific email address is found in the recipient list, a prompt message will pop out as below screenshot shown. Click No, the specific email address will be deleted immediately.
4. After sending the email, you can check its recipients in the Sent Items folder, the certain email address has been excluded from the recipients, see screenshot:
Best Office Productivity Tools
Kutools for Outlook - Over 100 Powerful Features to Supercharge Your Outlook
📧 Email Automation: Out of Office (Available for POP and IMAP) / Schedule Send Emails / Auto CC/BCC by Rules When Sending Email / Auto Forward (Advanced Rules) / Auto Add Greeting / Automatically Split Multi-Recipient Emails into Individual Messages ...
Over 100 Features Await Your Exploration! Click Here to Discover More.