gmailctl for mail tagging

less time waisted organising email

In 2019 I decided, to try and get on top of the nightmare that was my inbox by trying to make it easy to categories them. Essentially the idea was that if there is a clear and obvious place for the email to live, then it should be easy to archive them.

I started going through about 6000 emails and trying to find archive folders to push them into so I could finally have an inbox that wasn't filled which rubbish.

This never really worked that well, so in the course of the last 2 years I have been using gmailctl to bulid a complex set of rules to filer mail into folders. As a positive, i could always quickly see the tags i have on every email in GMail.

The configuration looks like this,

  version: 'v1alpha3',
  author: {
    name: 'Russell Sim',
    email: 'russell.sim@gmail.com',
  // The set of possible labels.
  labels: [
    { name: 'lists/debian-devel' },
    { name: 'lists/debian-devel-announce' },
    { name: 'lists/debian-dug-nordic' },
    { name: 'lists/debian-melb' },
    { name: 'lists/debian-newmaint' },
    { name: 'lists/luv-announce' },
    { name: 'lists/luv-jobs' },
    { name: 'lists/luv-main' },
    { name: 'lists/melbourne-pug' },
    { name: 'travel' },
  rules: [
    // Lots of extra rules are omitted from here, but there is one
    // rule per-label.
  ] + [
      actions: {
        labels: [
      filter: {
        or: [
            from: email,
          for email in [

This on set of rules in this example shows that the system is based around categorisation of emails. New emails are grouped into a category like travel. The idea is that I can then easily filter what is important. Currently I have about 80 distinct labels.

This can then be combined with notmuchmail to allow the categories to propagate through. This allows a reasonable degradation between the mobile apps and notmuchmail. The major classification implementation is in GMail so this means that when archiving in the mobile or browser applications, it will correctly file the emails into the right location.

The one drawback is that to add existing emails to the correct folder, they have to be searched for manually, and then moved. This is pretty darn annoying, but since I only have to do it once, and lots of the emails can be deleted anyway, it's not the worst thing in the world.

At least this will get me to an empty inbox, and hopefully set me up to have a mechanism to manage it better from both mobile apps and desktop ones.

Copyright © 2019-2023 Russell Sim (rsl@simopolis.xyz).

Author: Russell Sim (Mastodon | SourceHut | Github) Date: 2022-10-05 Wed 00:00 Emacs 29.0.91 (Org mode 9.6.5)