How to Auto BCC Specific Emails to a Certain Person with Outlook VBA

If you frequently need to BCC specific emails to certain persons, you must hope that Outlook can automatically add the person to BCC field. This article will teach you how to realize it.

By default, Outlook rule can help us to auto CC specific emails to selected persons. But it doesn’t support auto BCC. If you’re always required to BCC specific emails to certain contacts, you should look for other methods, such as by add-ins or VBA codes. Here we will teach you achieve auto BCC by means of VBA.

Auto BCC Specific Emails to a Certain Person with Outlook VBA

  1. To start with, launch Outlook application and switch to “Developer” tab.
  2. Click on the “Visual Basic” button in the “Code” group.

Visual Basic Button

  1. Then the “Microsoft Visual Basic Application” window will show up. Now you should double click on “ThisOutlookSession” project to open it.
  2. Next copy the following codes into “ThisOutlookSession” dialog box.
Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim Recip As Recipient
    Dim BccRecip As String

    'Specify the "To" recipient
    'You can replace "test" as per your needs
    If InStr(LCase(Item.To), "test") > 0 Then
       BccRecip = "example@mail.com"
    Else
       Exit Sub
    End If

    Set Recip = Item.Recipients.Add(BccRecip)
    Recip.Type = olBCC
 
    If Recip.Resolve Then
       Cancel = False
    Else
       Cancel = Ture
    End If
End Sub

Copy and Paste the VBA Codes in ThisOutlookSession

Note:

  • Supposing you want to specify the email subject, replace “If InStr(LCase(Item.To), “test”) > 0 Then” with the codes below:
If InStr(LCase(Item.Subject),"test") > 0 Then
  • Provided that you want to specify if there are attachments, replace with:
If Item.Attachments.Count > 0 Then
  • If you want to connect several conditions, use “And”, like the followings:
If InStr(LCase(Item.To), "test") > 0 And Item.Attachments.Count > 0 Then
  • Please ensure that the email address of “BCCRecip” is correct and in right format, otherwise, the email won’t be sent out.
  1. After pasting the code, click the save icon in the toolbar.
  2. Subsequently, you need to sign the code and modify the macro setting. About the detailed steps, you can refer to the Step 2 in “2 Steps to Auto Mark Junk Emails as Read in Outlook”.
  3. Finally you can have a try. Compose an email based on the specific conditions in the VBA codes. The results will look like the following picture:https://www.datanumen.com/outlook-repair/

What to Do in Case of Outlook Corruptions

Even though Outlook is feature rich, it still can get corrupted easily due to various reasons, such as power outages, virus infections and human errors, etc. Thus, you should keep vigilant against these threats. Also, learning how to deal with them is also a matter of necessity. If you have backups, you can readily recover Outlook file. But if no backup in place, you should utilize inbox repair tool or third party software, like DataNumen Outlook Repair, to rescue your Outlook data.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair SQL data error and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.