Label *All* Forwarded Messages In Gmail

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 [email protected] 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: [email protected] 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:[email protected] 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.

25 Comments

  1. This is also incredibly useful for me as since I own my own domain, whenever I sign up for some service somewhere, I automatically go to my domain panel and set up a mailforward for [email protected] to forward to my gmail account and then use THAT address for the signup email. This way I can catch if that service’s email address starts getting spammed.

    But, since the way gmail works does not show the originating address easily, now with this, I have the labels showing where the spam originated much more easily.

    Thank you; this is a BRILLIANT idea.

  2. It doesn’t work for me :(
    The deliveredto: filter fails to find [email protected] and also fails to find [email protected]. (I tried various forward addresses and mail accounts to forward from. And wrote maybe 20 test messages. ^^)
    All forwarded messages from other mail accounts appear in my gmail inbox. And all those forwarded messages have a Delivered-To header. But after that appears every time [email protected], not [email protected] and not [email protected] – although forwarded to these address.
    I think gmail changes the Delivered-To header to [email protected]. Has someone else this issue? A workaround? Is this a recent change on gmail?

  3. So brilliant, thank you so much!

  4. Works great thanks! Yahoo mail was causing me lots of issues so just ended forwarding to gmail to avoid using yahoo!

  5. Just tried it without bothering to set up the you+someid forwarding. Turns out Gmail is now smart enough to see past the first “deliveredto.” One can directly sort something that was originally delivered to “you.hotmail.com” by “deliveredto:you.hotmail.com”

  6. Just wanted to say that this didn’t work for me at first.
    I had to use DeliverdTo: rather than the all lowcaps deliveredto: you suggest.
    That might just have been an issue for me but if this isn’t working out for you, you could at least try it.

  7. Fantastic thank you! I used to use POP to get my .edu email to my personal gmail. The school’s email system was upgraded so that my .edu was ported into a special school gmail thing. I couldn’t figure out how to POP from one gmail to another (not that I really liked the POP thing…too slow to retrieve).

    So the forward from one gmail to another was great except my label that POP used to catch no longer did. I tried the to and from fields in my label filter to no avail. After a bit of frustration (and figuring out how to adequately describe my issue to google search) I found this page and write up.

    This does exactly what I wanted! Thanks to the author(s)

  8. Great article!

    • I’ve got two Gmail accounts setup this way and I wasn’t required to do anything special — the verification e-mail arrived like normal.

      Perhaps the verification e-mail landed in Spam, or perhaps the system doesn’t send the verification immediately?

  9. I may be misunderstanding but this still isn’t working for me…

    In my non-gmail account (a college account) I set it up to forward to [email protected]. However, when my non-gmail forwarded messages appear in gmail there is no indication of where they were forwarded to. So only the messages that have my non-gmail account in the send to field are being filtered (not messages that are sent to a mailing list)

    What am I doing wrong?

  10. thanks a million, this was very helpful!

  11. good article man.

  12. 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!

  13. this is incredibly cool!!!!! thank you so much! lifechanging hahahahha

  14. This is exactly what I was needing to do and didn’t know quite how to pull it off. Thank you for the info.

  15. 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.

  16. 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 [email protected] that forwards to [email protected], but there are also other addresses like [email protected] that forward to [email protected] (and you may get mail directly at [email protected] as well). In this case, just change the filter that redirects “.owncode” to the Google address to include a +owncode plus address. Make [email protected] forward to [email protected] — 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.

  17. 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. :)

Leave a Reply

© 2014 quietmint

Theme by Anders NorenUp ↑