Is there a way to search/filter gmail emails by the absolute domain without subdomains? If just do a search/filter on from:@google.com it includes all subdomains like plus.google.com, txt.voice.google.com, etc.

I know I can manually exclude all of those with -{from:plus.google.com from:txt.voice.google.com}, but the list of subdomains is quite long (and I don't really know the full list).

  • 1
    Did you try from:"@google.com" ?
    – BrianAdkins
    Feb 23 '13 at 19:57
  • Yes, from:"@google.com" unfortunately works the same as from:@google.com. It really seems like gmail is ignoring the @ sign.
    – studgeek
    Feb 24 '13 at 16:10

What you can use is a Google Script that does regex match with the TO field to find emails with an exact domain in the address:

function myFunction() {

  var label = GmailApp.getUserLabelByName("Google.com");
  if (!label) label = GmailApp.createLabel("Google.com");

  var threads = GmailApp.search("from:google.com");
  for (var t in threads) {
    var msg = threads[t].getMessages()[0];
    if (msg.getTo().match(/\@google\.com/)) {


Also see: Advanced Gmail Search with RegEx

  • I like the idea, and it eliminated txt.voice.google.com, but for some reason I still see plus.google.com. I've looked at the original message and it sures looks to me like your trick should work. The From line is From: "Google+" <noreply-2xxxxxxb@plus.google.com>
    – studgeek
    Feb 24 '13 at 16:07
  • PS, Thanks for your blog. It's helped me out in the past :).
    – studgeek
    Feb 24 '13 at 16:07
  • Actually, it doesn't seem to be working me at all now. It seems like the search engine ignores the periods.
    – studgeek
    Mar 1 '13 at 16:49
  • 1
    Unfortunately, I does not work. I've started a bounty, hoping for answers... Aug 6 '15 at 15:44
  • 1
    See my updated answer. Aug 6 '15 at 19:19

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.