Label *All* Forwarded Messages In Gmail

5 March 2008
8 — Tags:

If you’re like me, you’ve gotten tired of checking each of your multiple email accounts and have finally decided to have all of your mail forwarded to your main Gmail account. You login to the extraneous accounts and set them to forward to you@gmail.com. You login to Gmail and setup filters based on the To: header so your forwarded mail is automatically colored orange. It sounds like a great plan — and it is — until you discover that only some of the forwarded messages are getting labeled. Huh? As it turns out, those mailing list messages are addressed To: mailing.list@school.edu and those viral marketers can’t be bothered with the To: header at all, so your filters aren’t very effective.

Fear not, however, because there is a simple solution to this problem! This trick works because of plus addressing, a feature in Gmail that allows you to create an unlimited number of email addresses by adding a plus symbol (+) after your username. In other words, all mail sent to you+anything@gmail.com will arrive in your inbox. You can take advantage of this when aggregating your email accounts by having your secondary accounts forward to a unique plus address. For example, set your school email to forward to you+school@gmail.com and set your spam account to forward to you+junk@gmail.com.

Now for the real key: Gmail has a secret “deliveredto:” search operator that will catch all mail arriving at the given email address — whether or not you were listed in the To: header. In other words, this will even apply to messages from mailing lists and bcc emails. To automatically label you forwarded junk mail, for example, create a new filter and type deliveredto:you+junk@gmail.com in the Has the words textbox. Congratulations, now all of your forwarded email will be automatically labeled! The deliveredto: operator expects you to enter the entire email address, but if you want to filter on just a portion of the email address, you can place it inside of double quotes (for example, deliveredto:”+junk”).

Gmail Junk

Coincidentally, an Official Gmail Blog post about plus addressing appeared about six hours after this was published. Although plus addressing is nothing new, this is the first time Google has publicly acknowledged its existence on their blog. The official blog post did not mention the real secret to making plus addressing work, though, which is the “deliveredto:” operator.

8 Comments »

  1. Thanks for this tip ! Actually you can type a part of an email address if you place it between quotes. (“)

    I have a problem though. Maybe you’ll be able to help.

    I don’t add the + of google but a “.owncode” suffix on an email address that I want to redirect. I then set a filter in the catch all account, forwarding to the appropriate address.

    The problem is that the new Delivered-To header contains that new appropriate address. The mail still contains the original Delivered-To, but in second position.

    Do you know how I can access this second Delivered-To header, the original one ?

    Thanks again for sharing. This tip is a life saver. :)

    — Phil, 28 March 2008
  2. Since you can only access the first Delivered-To: header, you must put all the required information into this first header.

    If I understand correctly, you have an address like you.owncode@somewhere.com that forwards to you@gmail.com, but there are also other addresses like you.blah@somewhere.com that forward to you@gmail.com (and you may get mail directly at you@gmail.com as well). In this case, just change the filter that redirects “.owncode” to the Google address to include a +owncode plus address. Make you.owncode@somewhere.com forward to you+owncode@gmail.com — the mail will still arrive in the correct Gmail account, but now the first Delivered-To: header will contain “+owncode”, allow you to appropriately filter the message.

  3. I already did that before your answer. Your article gave me the idea of using “internal pluses”. :)

    You misunderstood my situation a little. In fact, I own a domain and I’m using google apps.

    I give fake email adresses with ‘allowing suffixes’ to my contacts, to class and track them. The catch-all account then forward the messages, or not, according to the suffix.

    I then use my registrar SMTP server to answer with an appropriate “From” (smtp.gmail.com reveals your true identity in the envelope sender address, when you try to ’spoof’ it). The answer is then copied to the ‘Message Sent’ folder, imap way.

    Thanks for your fast answer.

    — Phil, 28 March 2008
  4. This is exactly what I was needing to do and didn’t know quite how to pull it off. Thank you for the info.

    — Kenny, 21 January 2009
  5. this is incredibly cool!!!!! thank you so much! lifechanging hahahahha

    — Abe, 28 July 2009
  6. wow, really works like a charm … this really helped with my new mail forwarding i set up with a new domain. I actually cannot think of another way I could have gone about this… sweet!

    — Abe, 28 July 2009
  7. good article man.

    — Anonymous, 30 October 2009
  8. thanks a million, this was very helpful!

    — Anonymous, 28 February 2010

Leave A Comment