How to Batch Send Email to All the Contacts in a Specific Domain

At times, you may wish to batch send an email to all the contacts in a specific domain. In this case, you can use the method introduced in this article to quickly get it.

For some reasons, sometimes, you may need to send an email to all the contacts in a specific domain in your Outlook. For instance, you are required to send an email to all of your colleagues whose email addresses are certainly in a specific email domain. It will be quite troublesome if you manually find out these contacts. Therefore, here we will introduce a quick method to get it. The followings are the detailed steps and VBA codes.

Batch Send Email to All the Contacts in a Specific Domain

Batch Send Email to All the Contacts in a Specific Domain

  1. In the first place, launch your Outlook application.
  2. Then press “Alt + F11” key buttons to access Outlook VBA editor,
  3. Next you need to open a module which is not in use or straightly insert a new module.
  4. Subsequently, copy and paste the following VBA codes into it.
Sub SendanEmailtoAllContactsinSpecificDomain()
    Dim objContactsFolder As Outlook.Folder
    Dim objItem As Object
    Dim objContact As Outlook.ContactItem
    Dim strEmail1Address, strEmail2Address, strEmail3Address As String
    Dim objMail As Outlook.MailItem
    Dim objMailRecipients As Outlook.Recipients
 
    Set objMail = Application.CreateItem(olMailItem)
    Set objMailRecipients = objMail.Recipients
    Set objContactsFolder = Application.Session.GetDefaultFolder(olFolderContacts)
 
    For Each objItem In objContactsFolder.Items
        If objItem.Class = olContact Then
           Set objContact = objItem
           strEmail1Address = objContact.Email1Address
           strEmail2Address = objContact.Email2Address
           strEmail3Address = objContact.Email3Address

           'Change the specific email domain
           If InStr(strEmail1Address, "@datanumen.com") > 0 Then
              objMail.Recipients.Add (strEmail1Address)
           ElseIf InStr(strEmail2Address, "@datanumen.com") > 0 Then
              objMail.Recipients.Add (strEmail2Address)
           ElseIf InStr(strEmail3Address, "@datanumen.com") > 0 Then
              objMail.Recipients.Add (strEmail3Address)
           End If
 
        End If
    Next objItem
 
    objMail.Display
End Sub

VBA Codes - Batch Send Email to All the Contacts in a Specific Domain

  1. After that, you need to change your Outlook macro security level to low.
  2. Optionally, if you frequently need to send such an email, it is also suggested to add the new macro to Quick Access Toolbar.
  3. At this point, you can take a try. Click the “run” icon in the toolbar.run this macro
  4. Eventually, a new email will pop up. You can find that all the email addresses which are in the specific email domain have been included in the “To” field, like the following screenshot:Email Addresses in a Specific Domain

Never Panic In Face of PST Errors

Users tend to panic when encountering serious PST issues, such as inaccessible PST errors, virus infected PST file or corrupt Outlook PST data, etc. However, it is wise to calm down and try best to resolve it as soon as possible. First of all, you can try restarting Outlook. If issues persist, you can recur to the inbox repair tool, Scanpst.exe. But, assuming that it cannot make any effects, you can take recourse to a more experienced tool, like DataNumen Outlook Repair.

Author Introduction:

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

Comments are closed.