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”).

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.

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.

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?

Okay, now it all functions… ???
I changed nothing – all was like I described before. Now the address in the deliveredto header appears as supposed ([email protected] or also [email protected]).
I think it took time to change the deliveredto functionality in gmail, because before I never used the deliveredto filter.
So, if someone has the same issues like I described before – it is worse the time to wait some hours (with the new configuration)… :/

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”

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.

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.

If you’re using the POP route instead of the forwarding route, Gmail provides an option for “Label incoming messages” when setting up the POP account. Use this to label all the incoming messages. And like you said, to label all the outgoing messages (e.g., if you’ve also setup Gmail so it can send mail from your [email protected] address) you can use a simple from:[email protected] filter.

Hey,
I was wondering if you could tell me how I can use this to set up a forward from one gmail account to [email protected]
So far, if I try to set up forwarding, the verification email doesn’t arrive.
Cheers

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)

1) In your Gmail account, put deliveredto:[email protected] into the “Search Mail” box. If all of the messages from your college account don’t appear, something is probably wrong with the forwarding. Note that this won’t work for old mail that may have been forwarded before you added the +filter part.

2) In your Gmail account, open one of the messages that isn’t correctly labelled but was forwarded from the college account. Click on the arrow next to the “Reply” button and choose “Show Original”. The message source code should open in a new tab. The very first line should be Delivered-To: [email protected]. If the Delivered-To: line doesn’t display the proper address, something is probably wrong with the forwarding.

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.

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.