Filter Gmail Messages on Bcc field

by on December 15, 2008 at 10:10 am

Gmail filters have a number of fields and functions that aren’t well documented. One of the things that I wanted to do was filter all messages based on the bcc field. In order to do this, you need to learn about the deliveredto operator. If the bcc’d messages go to a unique address, your filter would look like this:

deliveredto:myemail+specialcode@gmail.com

To truly filter messages that are only received via bcc but that don’t have a special email address that they go to, you’ll need to do it this way:

deliveredto:myemail@gmail.com AND -to:myemail@gmail.com AND -cc:myemail@gmail.com

Enjoy!

  • Kam

    Ive tried that in the To field and it didnt work. Is that where that string should go?

  • Ah, it needs to go into the 'Has the words' box

  • Din

    Does the "from" box also need to include my email, so in your example above it would be:

    From: myemail@gmail.com
    Has the words: deliveredto:myemail@gmail.com AND -to:myemail@gmail.com AND -cc:myemail@gmail.com

    I put this information in and ran a 'test' on the filter, and it still pulled up 100s of messages.

    Thanks in advance.

    • No, the \”from\” box doesn't need myemail

      I think your query should work, but keep in mind it will also turn up
      messages that were sent to an email address other than yours (suchas
      myemail+newsletter@gmail.com)

  • Hahaha

    Thanks! I had tried using Delivered-To and some variations earlier but had failed. Poorly documented indeed.

  • Greg

    If you're using your own gmail and a mail is sent to you the "deliveredto:myemail@gmail.com" is TRUE and can be omitted from the criteria.

  • Sean

    THANK YOU!

    I've been looking for a solution to this! I receive emails from a list that usually BCC's me announcements but sometimes sends me personal emails. I needed to filter the BCC's to a label but let the TO's and CC's go to my Inbox. This finally lets me do that!

  • What is the "special code" in deliveredto:myemail+specialcode@gmail.com? Or how can one discover the special code?
    tks

  • Will this technique catch any bcc messages? Or is that impossible?

  • Dudley Brooks

    I can't get gmail's filters to *ignore* bcc. I tried "name@isp.com -bcc:name@isp.com" in Has Words, and I also tried Has Words name@isp.com with Doesn't Have bcc:name@isp.com. And in both cases, it returned messages in which name@isp.com *only* appears in the bcc field!

    • Archit Chandra

      Any way to do this?

  • mtech88

    Question for ya. I’ve tried for days to get your solution (and others) to work.

    I have a Gmail: SharedGmail@gmail.com
    Two of us, Sender1@gmail.com and Sender2@gmail.com, get all messages to SharedGmail forwarded to us. We also have full access to send as SharedGmail from the Sender1 and 2 accounts.
    This way Sender1 and Sender2 get all email sent to SharedGmail and can reply to them.

    However, with this setup, if Sender1 or 2 sends replies to email as SharedGmail, that reply should be forwarded to Sender2 or 1, respectively, only. (I know, way confusing.)

    Where I am trying to use your filter is that I would like it so that if Sender1 replies as SharedGmail, he can BCC to SharedGmail+SentBySender1@gmail.com and then I can use my forwarding filters to only forward that email to Sender2. (Sender1 does not need a copy of his own sent email.) And vice versa if Sender2 sends email as.

    I’ve tried this filter:

    deliveredto:SharedGmail+SentBySender1@gmail.com AND -to:SharedGmail@gmail.com AND -cc:SharedGmail@gmail.com

    but I get no results.

    I even have access to another domain that I could BCC and then throw the BCC emails away, so the BCC would be SentBySender1@otheredomain.com and then use this filter on SharedGmail account:
    deliveredto:SentBySender1@otheredomain.com AND -to:SharedGmail@gmail.com AND -cc:SharedGmail@gmail.com.

    No dice.

    Note that when I shorten the filter to either of the following, I get no results!!
    deliveredto:SharedGmail+SentBySender1@gmail.com
    deliveredto:SentBySender1@otheredomain.com

    I have also tried to use the BCC field directly as shown below, but to no avail.

    bcc:SharedGmail+SentBySender1@gmail.com AND -to:SharedGmail@gmail.com AND -cc:SharedGmail@gmail.com

    bcc:SentBySender1@otheredomain.com AND -to:SharedGmail@gmail.com AND -cc:SharedGmail@gmail.com

    I assume the mistake is syntax but I can’t get it to work and I’ve wasted HOURS trying to figure it out.

    Mil gracias.

    • Wow, that is quite a setup.

      I don’t think you need quite as complicated a setup.

      Rather than forward SharedGmail messages to the two accounts, use POP
      access to retrieve from it (leave messages on the server so the other
      account can get them as well). Then you won’t see outbound messages
      sent by your account.

      You can then choose to bcc the other sender if they want to see the response.

      I hope this helps!

      • devnullius

        you can’t pop3 other gmail accounts from gmail if I’m not mistaken…

  • James Lee

    Thanks for posting this! The key point that I wasn’t aware of (but is mentioned in the comments), is that one can enter arbitrary terms in the “Has the words” field. This is a great help!

  • janedoe

    just a quick note for those finding this thread only now: gmail has learnt the operator bcc:
    so if you put
    bcc:myemail@gmail.com
    in “Has the words”, it works fine.
    thanks for the initial idea! :)

  • Codell

    Thanks!  super helpful – was tyring to learn how to do this, and didn’t know the operators went in the “has the words” field (tried the “to” field) :)

  • Pingback: Create A Mail Rule To Track Sent Messages | Lifehacker Australia()

  • Pingback: Create a Mail Rule or Filter to Track Sent Messages You Want to Follow Up On | Simply P Squared()

  • Anyone know how to filter messages in gmail such that the sent messages for which there is not yet a recipient response are separated from the general ‘sent mail’ folder? In effect, I want a distinct mail bin for emails that I have sent to people, but have not received a response.

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License. | Dave Naffziger’s Blog | Dave & Iva Naffziger