Skip to main content

Kutools for Office — One Suite. Five Tools. Get More Done.

How to sort and group by sender domain in Outlook?

Author Kelly Last modified

Normally, we can easily arrange all email messages by sender, categories, subjects, size, etc. in Microsoft Outlook. However, it seems impossible to sort or group email messages by sender domains, because there is no Sender domain field for email messages at all. Here I will introduce a VBA code to help you add a Domain column for email messages, then sort and group the email messages by the sender domains easily in Outlook.

Office Tab - Enable Tabbed Editing and Browsing in Microsoft Office, Making Work a Breeze
Unlock Kutools for Outlook now and enjoy over 100 features with unlimited access forever
Boost your Outlook 2024 - 2010 or Outlook 365 with these advanced features. Enjoy 100+ powerful features and elevate your email experience!

To sort and group email messages by sender domains in Microsoft Outlook 2013 and 2010, please do as following:

Step 1: Open the mail folder where you will sort all email messages by sender domains.

Step 2: Turn off the Reading Pane with clicking the Reading Pane > Off on the View tab.

the screenshot of step about sorting and grouping by sender domain in outlook 1

Step 3: Go ahead and click the Add Columns on the View tab.

the screenshot of step about sorting and grouping by sender domain in outlook 2

Step 3: In the Show Columns  dialog box, click the New Column button.

the screenshot of step about sorting and grouping by sender domain in outlook 3

Step 4: In the New Column dialog box, type the Domain in the Name box, and keep the Text selected in the both Type box and Format box, at last click the OK button.

the screenshot of step about sorting and grouping by sender domain in outlook 4

Step 5: Now you get back to the Show Columns dialog box, select the Domain in the Show these columns in this order box, move it below From item, and click the OK button.

the screenshot of step about sorting and grouping by sender domain in outlook 5

Step 6: Now you go back to the opening mail folder, select all email messages with pressing the Ctrl + A keys at the same time.

Step 7: Press the Alt + F11 keys in a meanwhile to open the Microsoft Visual Basic for Applications window; then click the Insert > Module, next paste the following VBA code into the module.

VBA: Sort and Group by sender domain

Sub ListSelectionDomain()
Dim aObj As Object
Dim oProp As Outlook.UserProperty
Dim sDomain
On Error Resume Next
For Each aObj In Application.ActiveExplorer.Selection
Set oMail = aObj
sDomain = Right(oMail.SenderEmailAddress, Len(oMail.SenderEmailAddress) - InStr(1, oMail.SenderEmailAddress, "@"))
Set oProp = oMail.UserProperties.Add("Domain", olText, True)
oProp.Value = sDomain
oMail.Save
Err.Clear
Next
End Sub

Step 8: Run this VBA code with pressing the F5 key or Run button in the Toolbar.

Step 9: Now each sender’s domain is extracted and filled into the Domain column.

A. To sort the email messages by sender domains, just click the Column header of Domain at the top of all email messages;

the screenshot of step about sorting and grouping by sender domain in outlook 6

B. To group the email messages by sender domains, just right click the Column header of Domain, and select the Group By This Field from the drop down list. See screen shot below:

the screenshot of step about sorting and grouping by sender domain in outlook 7

Notes:

(1) This VBA code works well in Outlook 2013 and 2010, but doesn’t work in Outlook 2007.
(2) You can save the custom view easily with How to save and copy view settings to other folders in Outlook?


Related Article

How to view senders’ domain in mail list in Outlook?


Best Office Productivity Tools

Breaking News: Kutools for Outlook Launches Free Version!

Experience the all-new Kutools for Outlook with 100+ incredible features! Click to download now!

🤖 Kutools AI : Uses advanced AI technology to handle emails effortlessly, including replying, summarizing, optimizing, extending, translating, and composing emails.

📧 Email Automation: Auto Reply (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 ...

📨 Email Management: Recall Emails  /  Block Scam Emails by Subjects and Others  /  Delete Duplicate Emails  /  Advanced Search  /  Consolidate Folders ...

📁 Attachments ProBatch Save  /  Batch Detach  /  Batch Compress  /  Auto Save   /  Auto Detach  /  Auto Compress ...

🌟 Interface Magic: 😊More Pretty and Cool Emojis   /  Remind you when important emails come  /  Minimize Outlook Instead of Closing ...

👍 One-click Wonders: Reply All with Attachments  /   Anti-Phishing Emails  /  🕘Show Sender's Time Zone ...

👩🏼‍🤝‍👩🏻 Contacts & Calendar: Batch Add Contacts From Selected Emails  /  Split a Contact Group to Individual Groups  /  Remove Birthday Reminders ...

Use Kutools in your preferred language – supports English, Spanish, German, French, Chinese, and 40+ others!

Instantly unlock Kutools for Outlook with a single click. Don't wait, download now and boost your efficiency!

kutools for outlook features1 kutools for outlook features2

🚀 One-Click Download — Get All Office Add-ins

Strongly Recommended: Kutools for Office (5-in-1)

One click to download five installers at once — Kutools for Excel, Outlook, Word, PowerPoint and Office Tab Pro. Click to download now!

  • One-click convenience: Download all five setup packages in a single action.
  • 🚀 Ready for any Office task: Install the add-ins you need, when you need them.
  • 🧰 Included: Kutools for Excel / Kutools for Outlook / Kutools for Word / Office Tab Pro / Kutools for PowerPoint