Creating labels
Labels in Gmail can be considered as an equivalent to folders; they allow us to sort messages in as many categories as we want, to make them easier to find when we need to.
There is already, by default, a spam filter in your Gmail account and a newly introduced feature that shows promotions, social networks, and forum threads separately, but we might want to be more selective and have separate labels for all our mail activities.
As far as I am concerned, I like that every thread has a label. My computer (and its related online data) is the only thing that I keep tidy; too bad that's not the the case with my desktop.
So, I created labels for every possible type of e-mails: Facebook, Stack Overflow forum, computer spare parts distributors, audio equipment ads, and so on.
I might have done that using Gmail filters of course, or using my favorite mail-client application, but I did it with Google Apps Script; go figure out why.
Creating a label is very straightforward, as shown in...