Wednesday, 6 April 2005

How to use Gmail aliases to organise emails and handle spam






Delicious bookmarks before domain name change:

(how to set up a custom Delicious badge like this one for your own blog or website)

[If you want to know about Gmail username formats or email address formats or criteria (e.g. dotted), whether you can have a dot or dots and other characters in a Gmail email address, etc, see this post.]

The "aliases" feature of Gmail seems relatively little known, but can be very useful to help organise your correspondence and fight spam.

What's a Gmail alias? Well if your Gmail username is "user", then a Gmail alias is an email addresss in the format "user+something@gmail.com". All emails sent to an alias in that format will be received by you at the user@gmail.com account.
(Gmail usernames in fact can't be less than 6 letters long (see this post for more on Gmail usernames), so I deliberately used "user" in my example to avoid inadvertently hijacking someone's real username).

The beauty of aliases is:
  • you can have as many aliases as you like per Gmail username
  • the bit after the "+" sign in the alias can be just one character long (e.g. "user+1@gmail.com") or longer if you wish, and can consist of letters, numbers, dots/periods and even stuff you can't have in a normal Gmail username (as to which see the end of this post), e.g. some punctuation like "!" or symbols like hyphen, underscore etc, or a mixture (but not "@" or spaces, commas or semicolons or quotes; backslash won't do either though forward slash will - just experiment trying to send all sorts of combinations to yourself, if you really want to know!). Bear in mind though that some email programs won't let allow email to be sent if there is e.g. a slash or ampersand in the email address, so the safest bet really is to stick to letters, numbers and dots for the bit after the "+" sign
  • you can apply Gmail filters to individual aliases to help organise your correspondence (see below), and
  • by the same token you can use Gmail aliases as disposable email addresses to handle spam more effectively.

Aliases and Filters

Here's an example of using an alias. Suppose you're filling in a Webform for company X because you want to buy something from them or ask them a question. You give them as your email address, not "user@gmail.com", but say "user+X@gmail.com".
Some companies' staff can get quite confused if you include their company's name as part of your email address, especially if you give them the address on the phone. One solution may be to use something like "user+customerofX@gmail.com" if you get someone truly dim who utterly refuses to accept "user+X@gmail.com". Hopefully you won't!

Now, you apply a Gmail filter. Suppose your correspondence with X is about your truck (nod in the direction of redryder52 aka Kirk!).You could automatically tag all emails sent to this alias with the label "truck" (so that when you click on the "truck" label you can see all the correspondence you've tagged with that label, grouped together).

To do this you'd first click "Create a filter" (to the right of the search box):


Then in the To box enter "user+X" (without the quotes - in fact it works with or without quotes, it's just less work if you leave them out):


Then click "Next Step" and you'll get something like this:


Now, choose your options - in this case against "Apply the label" select the "truck" label (or create it):



Then click "Create Filter".

That's it. All future email addressed to the "user+X" alias will automatically be tagged or labelled with "truck" (and can be archived to bypass your Inbox, starred, etc too, if you picked those options). Although email sent from you won't be automatically tagged this way, because of Gmail's threading ("conversations") feature you should find them anyway if your sent email is threaded with emails sent to the alias you've added a filter for.
You could enter "user+X@gmail.com" in full in the "To" box but you don't have to, that's more unnecessary typing you can avoid! You could also enter just "+X" (without the quotes) and that's what I do, being idle - and that works, assuming you don't have another alias with a dot and other characters after the "+X", on which more below. But don't enter just "X" if there's any chance that "X" (or whatever alias you use) could form part of another alias or indeed part of one of your contact's email address, or things could get mixed up...

Another tip: remember I said earlier that you can have dots in the part after the "+" symbol? This means that you can have as an alias something like, for example, "user+X.anotherthing.yetanotherbit2@gmail.com" - where after the "+" sign you have several words or units separated by dots. And the bits after the "+" symbol in an alias are treated as distinct (and separately searchable) units if they're separated by dots. In other words, "X" is treated as separate from "anotherthing" and from "yetanotherbit2", and each of those units is treated as a different "word" when searching your Gmail.

Now Gmail doesn't yet allow you to assign multiple labels to items quickly - if you want to give an item more than one label, you have to apply one label at a time (which you can do to multiple items at once, admittedly, if you've ticked their checkboxes in the list first). So one way of giving a received email more than one "tag" at a time might be to include each "tag" as a word or bunch of other characters, separated by dots, after the "+" in the email alias. In other words you could use this feature almost as another kind of tagging mechanism if you like (though it's probably easier just to stick to Gmail's labels!). Call those units or words "quasi-tags", perhaps.

Here's an example to illustrate what I mean. Say you have an alias for your correspondence with X, and you class dealings with X as personal admin. You could tell X that your email is "user+X.admin@gmail.com". Now you might have correspondence with your bank, BiggieBankie, also about admin stuff - say to do with your house. You could use "user+BiggieBankie.admin@gmail.com" as the alias for that.

Then you could set up a filter where in the "To" box you put in "admin". This means that email sent to any aliases which have "admin" in them (where "admin" is separated from any other characters by dots) - in this case, anything sent to "user+X.admin@gmail.com" or to "user+BiggieBankie.admin@gmail.com" (or indeed even to "user+PVC.admin.fun@gmail.com") - will be found and filtered in the same way, with whatever options you choose (e.g. automatically tagged with the label "Administration").

Same if you buy stuff from yet another company, where you've given them as your email say "user+LeatherCorsets.admin@gmail.com" (nod in the direction of - well never mind..!). Those emails too will be filed under your Administration label, because they contain "admin" in the address (with a dot before that word - and after it, if it's not the last word after the "+" sign).

And if you have dealings with some other part of BiggieBankie, e.g. to do with your investments, you could use "user+BiggieBankie.invest@gmail.com" for correspondence with them. Then you could set up another filter with "BiggieBankie" in the "To" box if you wish, in order to group all your emails from BiggieBankie together, whether to do with your admin or your investments.

Alternatively, never mind the bother of fiddling with filters - if you just do a "Show search options" search and put "BiggieBankie" in the "To" box, you'll find all the BiggieBankie emails which have been sent to you (if you've gave this format of alias to them). Or if you put "invest" in the "To" when doing an advanced search, you'll find all investment-related emails sent to you provided you gave them an alias which included ".invest" in it. You get the picture. Again, you need to be careful what words you use after the "+" bit so that you don't duplicate stuff inadvertently, etc.

Of course all this works best if you use just one alias per correspondent, i.e. don't give the same alias to more than one correspondent - again, if you do your filtered emails could get in a mess. Remember you can have as many aliases you want, you could even use "user+X1@gmail.com" or "user+X.April05@gmail.com" for one set of correspondence with X and "user+X2@gmail.com" or "user+X.May05@gmail.com" for another set, if you wish.

Dealing with Spam

As for spam, well if you start getting spam addressed to "user+X@gmail.com" then you know it must have been X who sold your address to the evil spammers, and you can complain to X. More usefully, you can change your filter for all future email addressed to "user+X@gmail.com" so as to Move it to the Trash:


(This may mean you miss legit email from X, but you could check your Trash folder occasionally for it, and perhaps tell X that they should in future address emails to "user+X2@gmail.com" instead, and then repeat the process if you start getting spam at "user+X2@gmail.com"...).

In other words you can use Gmail aliases as disposable email addresses or DEAs (on which there will be more in a future post, as that was the most popular topic after Technorati in my 1-minute tick-box survey - which, by the way, is still open if anyone else would like to give their views). Very briefly, these are just "throwaway" email addresses you can use for particular purposes and then get rid of (e.g. by diverting all email sent to those addresses to your Trash) if you start getting spam addressed to them.

Issues

So are there any issues in relation to Gmail aliases? I can think of a couple.

Gmail wasn't designed to be primarily a DEA service, so while you can receive email addressed to an alias, and give an alias as your email address on the phone or Web, you can't send easily email from an alias via Gmail. (But if enough people suggest to Google (hint hint..) that they introduce the ability to send Gmail from the alias of their choice, who knows, maybe Google will oblige…)

Sending email from a Gmail alias using Gmail

What's the way round this? Well you can try changing the "Reply-to" address in your Gmail Settings to an alias before sending an email, but unfortunately the "From" in the email will still display as "user@gmail.com" (even if the reply goes to the alias), and similarly if you reply to an email that has been sent to an alias, the "From" will still show "user@gmail.com". So it's not a real solution in many ways. Still, many people may not mind that, as how much they'll be at risk of getting spam might depend more on how the recipient stores/harvests addresses from the emails they receive. However, if you changed your "Reply-to" before you sent an email, you have to remember to change it back to your usual Gmail address afterwards.

[Edited 30 August 2005, see this post:] Google now allow you to set different From addresses. To send an email FROM an alias, in Gmail go to Settings, Accounts, click Add another email address. In the popup, fill in the alias you want e.g. user+alias1@gmail.com (but beware, Gmail doesn't like you mixing a hyphen with numbers though it's fine with letters or mixing an underscore with numbers, letters with numbers, dots etc...), and click Next Step [Updated: Gmail now automatically recognises if you've filled in a Gmail alias and won't send an email to yourself, it'll just work], then Send Verification. An email is sent to the address you filled in for verification that it's really yours (yeah I know, they shouldn't need to verify your own Gmail alias, but...). Switch to your main Gmail window (or close that popup if you like, the details will still be saved in your Accounts page) and check your Inbox. In a few seconds, or maybe a minute or two, there should be an email from Google with a confirmation link to click - click it (or follow the other instructions in the email), and you're there. You can then delete that email if you like. Now, if you want to send an email that's from the alias, when you compose an email in Gmail, the From box has a dropdown arrow at the end from which you can pick the alias or other email address to use - and replies will go to that alias too (but on the Accounts page, under "When I receive a message sent to one of my addresses" be sure to select "Reply from the same address the message was sent to", otherwise, when someone emails an alias and you reply, you might inadvertently reply from your "real" email address instead of from the alias).

It's a bit longwinded so I more often use an email program on my own PC and set the From and Reply-to the alias, myself (see below). But it's another option, useful to have especially if you plan to be sending lots of mail from a particular alias.

Sending email from a Gmail alias using another program

Another solution to this problem is to use another email program, where you can set the"From" to your chosen Gmail alias, e.g. Outlook Express. If you're not using Gmail's SMTP server, b.c.c. the email to your Gmail address - ideally, to the same alias you've used for the "From" - so that you have a copy handy in your Gmail account and it's automatically tagged appropriately on receipt. (If you send the email via Gmail's SMTP server a copy is automatically saved in your Gmail Sent, but it still isn't tagged automatically - and more to the point, the "From" in the received email will refuse to show as anything but your normal Gmail address, no matter what aliases you've tried to add in the Accounts settings of your email program. So it's best to use another email server to send it).

Spammers?

The other issue is that a human spammer familiar with how Gmail aliases work would be able to figure out your real Gmail address from the alias, and start targeting that instead (or, worse still, get their spamming software to automatically strip out the "+whatever" before the "@" in Gmail addresses, or to make up their own versions of Gmail aliases for your Gmail username and start spamming those aliases). In which case we're back to relying on Gmail's built-in spam filter.

However I think that having the extra "layer" of an alias between you and possible spammers can't hurt, and may well help (and surely it's still better than giving out your real direct Gmail address from the get go). In most cases I suspect using an alias as a DEA will be fairly effective. And the "self-organising email" reason for using aliases is still valid, despite the risk of spammers going behind the alias or abusing the alias system. Furthermore, this risk is common to many DEA services, whose addresses will often be in the format "alias@user.deaservice.com" or "alias.user@deaservice.com" and will thus be susceptible to the same "oooh let's make up aliases and spam 'em" issue. (That problem isn't in fact insuperable and ingenious ways to deal with it exist, but I won't discuss it further here.)

Overall though, the possible problems seem relatively minor compared with the benefits, and I think Gmail aliases are a Very Good Thing and extremely useful, particularly for dealing with spam.

For info on another excellent email alias service providing disposable email addresses which you can use in conjunction with your regular ISP email address (you don't need Gmail), see my write up on Spamgourmet. I use it all the time, myself.

[Edited 15 April 2005 to add the pics, and 30 May 2007 to reduce the pics to stop sidebar drop and add Delicious badge for old domain and ref to Spamgourmet for those interested.]


Technorati Tags: , , , , , , , , , , , , , , , , ,

8 comments:

TaB said...

Very cool Improb! And again.. thanks for the time and sharing, you are the queen of tweekville you know that?
Bet you can make a cool lemonade too hehe..

Things look a little odd in my view (i just put linux gnome on) :) so maybe I need to tweek..
i'll mail you before i leave..

Zoli Erdos said...

I tried another creative use of aliases as part of a labeling/archieving strategy:

- Most email comes to my own domain, which I can set both for pop downlowad and fowarding to my gmail "searcheable archieve". It is at the point of forwarding that I apply the +xxx alias, depending on the sender or subject matter. This way I should get a nice archieved classifid by subjects .. except ...

... except for the fact that gmail filters only recognize the alias in the primary To: field, not in forwarded mail. In other words the forwarded mail is received in my email box properly, but I can't use the information coded in the +alias. I'm sure it's a glitch and hope Google will fix it one day.

Improbulus said...

Thanks for your comment and the link, Zoli. Sorry not to have picked up on it before.

I know exactly what you mean. I tried that too, and it doesn't work. It would be interesting to know if Google will sort it or not, let's hope so.

Spam said...

I've been doing this for a few months now and it works well - I often use an alias for nearly all my accounts and filter for some of them by adding labels. However, the main problem that I run into is that many sites won't allow you to use the '+' symbol in your email address - they'll tell you that it's an invalid email address, or in the case with Citi and a few others, it seems to just strip out the + for you after saying it's invalid... so if you don't notice that, you'll be signing up under the wrong email!

There is 2 solutions to this - first, you can use the dot/period alias mechanism. Since dots are normally legal in most email systems, I doubt many sites would disallow them. First.LastName is a common theme for businesses. Hence, you could add dots in various places and trigger rules on that, although it's must less elegant than using + signs.

Second, you could use the reverse of the above strategy - send out your root email to spammers! Any email sent to Name@gmail.com will get automatically spammed or however else you want to handle 'unknown' mail. Tell all your friends to use Name+Friends@gmail.com, have your banks use Name+Banking@gmail.com, etc, etc.

You'll still run into the problem that some sites won't let you use + aliases, so then you'll have to manually handle those cases with rules or perhaps use a second gmail address that just forwards to your main one (again, to guard against your main address from getting on spam lists).

I haven't implemented such a system yet - anyone have any experience doing such things?

-Thracx

Anonymous said...

Yahoo has had a function like this for years, only better: the base is not your actual email address, so it is truly spam-proof.

Carl said...

I agree with the previous post; Yahoo's implementation is better. It wouldn't be hard for a spam program to detect the '+' and extract your real address from the alias.

Yahoo also allows you to specify, for each alias, whether you can send mail from that address.

On the whole, I prefer Gmail, but I keep a Yahoo account as well just to have this feature...

mr_p said...

When you send a mail by Gmail from alias then original email address is put into "Sender:" header. So using aliases won't hide your real email address if you reply.
MS Outlook uses that header and shows infamous "on behalf of" in From field of mail.

Adrian Hughes said...

gmail aliases are great but some websites don't accept them as valid email addresses. I hope this will change over time