8

I need an Outlook Search Folder that finds e-mail by searching the sender or recipient's actual e-mail address. For example, if I want find all messages from senders in the domain example.com, I use the search criteria From... @example.com:

enter image description here

But the search only returns messages where @example.com appears in the sender's Display Name (e.g. From: John Doe <john@example.com>). If the name doesn't contain their e-mail address, the e-mail doesn't appear in the search results.

How do I search for e-mails based on the actual To/From/CC e-mail address, even if the address is not present in the Display Name?


What I've tried:

  • I've reviewed all the available fields on the Advanced tab. I see the "From", "To", etc. fields but they work the same way.
  • I found this post, which suggests searching the Subject field and message body...but that is very unreliable.
  • Google....but there's a billion results telling me how to do what I'm already doing.
5

I need an Outlook Search Folder that finds e-mail by searching the sender or recipient's actual e-mail address.

It's possible to configure a Search Folder to find email based on the Sender's actual e-mail address (see below). However, it's not possible to expose the actual e-mail address for the To, Cc, or Bcc fields. An explanation of why can be found at the end of this answer.

Configure Search Folder to Search on Sender's Actual E-mail Address

Note: These instructions are written for Office 2013, but the solution should work for at least Outlook 2007 and later.

Step A: Add a Custom "Sender's Actual Address" Field to Outlook Using a Form

These steps create a custom form that adds a new field to Outlook with the sender's actual email address:

  1. Save the following custom Outlook form configuration with the file name FromEmailAddress.cfg:

    [Description] 
    MessageClass=IPM.Note
    CLSID={00020D31-0000-0000-C000-000000000046} 
    DisplayName=From Email Address 
    Category=Standard 
    Subcategory=Form 
    Comment=This forms is used to expose a sender's actual email address.
    LargeIcon=notel.ico
    SmallIcon=notes.ico 
    VersionMajor=1
    VersionMinor=0
    Locale=enu 
    Hidden=1 
    Owner=Microsoft
    [Platforms]
    Platform2=NTx86
    Platform9=Chicago
    [Platform.NTx86]
    CPU=ix86
    OSVersion=WinNT3.5
    [Platform.Chicago]
    CPU=ix86
    OSVersion=Win95
    [Properties] 
    Property01=FromEmailAddress
    [Property.FromEmailAddress] 
    ;PropTag=PR_SENDER_EMAIL_ADDRESS, 0x0C1F001E
    Type=30     ; 001E = 30 in decimal
    NmidInteger=0xc1f   ; 0C1F
    DisplayName=From E-mail Address 
    [Verbs] 
    Verb1=1 
    [Verb.1] 
    DisplayName=&Open 
    Code=0 
    Flags=0 
    Attribs=2 
    [Extensions] 
    Extensions1=1 
    [Extension.1] 
    Type=30 
    NmidPropset={00020D0C-0000-0000-C000-000000000046} 
    NmidInteger=1 
    Value=1000000000000000
    
  2. Copy the FromEmailAddress.cfg to your language-specific Microsoft Office's Forms folder, located at:
    C:\Program Files (x86)\Microsoft Office\OfficeXX\FORMS\<LanguageID>

    • <OfficeXX> is the Office folder including the version number (e.g. Office15 for Office 2013)
    • <LanguageID> is your 4-digit language ID (e.g. 1033 for English).

      Note: Administrative rights are required to save files to this folder.
      Note: Office may be installed in C:\Program Files if you have a 32-bit OS, or a 64-bit version of Office on a 64-bit OS.

  3. In Outlook, on the File tab of the ribbon click Options.

  4. Click Advanced in the left pane, then in the Developers group click Custom Forms... enter image description here
  5. In the Options dialog, click Manage Forms...
  6. In the Forms Manager dialog, click Install... enter image description here
  7. Navigate to the folder where you saved the FromEmailAddress.cfg file, select it, then click Open.
  8. Click OK on the Form Properties window that opens, then Close, followed by OK twice to close Outlook Options.

Credit to this slipstick.com article for information on how to expose a sender's actual e-mail address as a field.

Step B: Use the Custom "From Email Address" Field in a Search Folder's Criteria

These steps leverage the newly created field as criteria for a Search Folder:

  1. On the Advanced tab of the Search Folder Criteria dialog box, click the Field drop-down, then click Forms...
    enter image description here
  2. In the left pane select From Email Address, click Add -> then Close. enter image description here
  3. Click the Field drop-down again, point to From Email Address then click From E-mail Address on the fly-out menu.
    enter image description here
  4. Specify the desired Condition and Value, then click Add to List, then OK to close the dialog. enter image description here

The Actual To, Cc, and Bcc E-Mail Addresses Can't Be Used as Criteria for Search Folders...

A thorough search of Outlook's other pre-defined fields, the MAPI fields available through Outlook's Object Model, and a review of properties exposed by OutlookSpy reveals there are no fields that expose these e-mail addresses as text. There is the PR_MESSAGE_RECIPIENTS property, but unfortunately this is an object that contains each recipient as a separate item. Accessed natively (using the Custom Form method above) returns nothing.

...With One Almost Useless Exception

Using the VBA from this slipstick.com article I was able to add a User Defined Field (UDF) to messages that contained a single string containing the recipient e-mail addresses in the format john@example.com, jane@example.com. However, when selecting a UDF in the Search Folder Advanced Criteria's Field list, only UDFs defined in the Inbox are available:

enter image description here

If messages with the custom fields populated exist in the Inbox, they are found by the Search Folder. However, such messages located in other folders are not included in the results. Unless your Search Folder is only interested in the Inbox, this is rather useless.

Reasons why UDFs don't work in the criteria of a Search Folder are documented here, here and here.

The Pre-Defined Fields Are Still the "Best" Solution

When it comes to the To:, Cc:, and Bcc: fields, it's still best to use the pre-defined fields in your Search Folder criteria and hope the actual e-mail address is part of the Display Name (which it often is).

7
  • If anyone finds a solution for exposing the actual e-mail address of the To:, Cc:, or Bcc: fields in such a way that they can be used as criteria for a Search Folder, I'd love to hear about it. Many others would find it useful too. – I say Reinstate Monica Apr 15 '17 at 15:05
  • Great tip, but be advised this is the email address of the Sender. This isn't always the same as the From email address (I know, it's ridiculous). – TastyWheat Aug 28 '17 at 13:56
  • @TastyWheat Can you give me an example of what you mean? Are you referring to the fact the sender's email address can be set to whatever the sender wishes? Or something else? – I say Reinstate Monica Aug 28 '17 at 14:05
  • In a few cases I get emails with a Sender of jdoe@mailserver.com but the email is From noreply@someservice.com. This is done because John Doe took an action on someservice.com that triggered the email, although he himself didn't compose and send the email. – TastyWheat Nov 21 '17 at 21:36
  • @TastyWheat You are correct. The original question seeks to work with the Sender address, ignoring "From/Display name/Sent on Behalf of" information. – I say Reinstate Monica Nov 21 '17 at 21:44
1

Unfortunately, you can't do that using Search Folders, sorry. As a workaround, you can use Filtered Views:

  1. Create a new Outlook folder View (View ribbon tab).
  2. Specify the Filter for the created View on SQL tab:
    "http://schemas.microsoft.com/mapi/proptag/0x5D02001F" LIKE '%@example.com'

The 0x5D02001F property is a PR_SENT_REPRESENTING_SMTP_ADDRESS MAPI property. You can also add more properties to check using AND/OR if needed.

Alternative way (using User-Defined Fields)

  1. Open the Inbox and create the user-defined field:
    1.1. On the View ribbon tab click the View Settings button.
    1.2. On the Advanced View Settings window click the Columns... button.
    1.3. On the Show Columns window click the New Column... button.
    1.4. On the New Column window type the desired name (say, "Sender Email" without quotes) and leave Type and Format as Text.
    1.5. Click OK, OK, OK to confirm on all dialogs.

  2. Copy the 0x5D02001F property to Sender Email property for all messages in your mailbox any way you like, by using VBA or third-party software. Here is the key part of VBA (if you're going to write a script to copy properties):

... ' for each objMailItem get the value of 0x5D02001F property
Set objProp = objMailItem.UserProperties.Add("Sender Email", 1, False)
objProp.Value = ... ' The value of 0x5D02001F property
  1. Create a Custom Search Folder and specify the Criteria on the Advanced tab: Field -> User-defined fields in Inbox -> Sender Email contains @example.com.

That's pretty much of it. Works perfectly for the whole mailbox.

10
  • This only affects a single folder. I need to find email located throughout the mailbox. – I say Reinstate Monica Apr 14 '17 at 16:39
  • No way, sorry. You can only create a view "for all folders in mailbox" and apply it, after that click on each folder to see the emails. – thims Apr 14 '17 at 16:53
  • As an alternative, you can create a custom Outlook user property and copy sender's email address to this property for all your messages. After that you'll be able to use this user property in a Search Folder criteria. – thims Apr 14 '17 at 18:56
  • Nope, tried that. UDFs straight up don't work in Search Folders (for criteria). So dumb. – I say Reinstate Monica Apr 14 '17 at 18:58
  • What do you mean by "straight up don't work"? – thims Apr 14 '17 at 19:48
1

You can't do fancy searches using the To/From/Cc/Bcc fields in Search Folders without creating custom forms, but there is a work around for finding senders in a certain domain using the "Mail from specific people" option. (This also works for the "Mail from and to specific people" option.)

  1. When creating a Search Folder, select Mail from specific people in the "New Search Folder" dialog. Then click the Choose… button

    New Search Folder dialog

  2. In the From -> box, enter the domain(s) you want to search for in the format: @domain.com. You can include multiple domains by separating them with a semi-colon (;).

    Select Names dialog

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.