Subject: Re: [sup-talk] 0/0...I made it

From: David J. Hamilton <[email-masked]>
Date: Mon, 14 Feb 2011 10:11:40 -0800

Philippe,

Excerpts from Philippe LeCavalier's message of Sun Feb 13 12:57:30 -0800 2011:
> Well, despite not finding a truly efficient method for autolabeling my mail
> -I'm not worried I won't, I just haven't found it yet- after 30 some days of
> due deligence my inbox is for now back to 0.

Have you tried writing a before-add-message hook?  If so, what problems have you
run in to with your attempts at autolabeling?

Here's a snippet of mine:

  # before-add-message.rb

  def autolabel message, label 
    log "Adding label [#{label}] to #{message.id}"
    message.add_label label
  end

  def autolabel_email message, regexes, label
    regexes = [ regexes ] unless regexes.is_a? Enumerable
    if message.recipients.any? do |recipient|
          AccountManager.is_account_email? recipient.email and
            regexes.any?{ |r| recipient.email =~ r }
        end
      autolabel message, label
    end

    if    AccountManager.is_account_email? message.from.email and
          regexes.any?{ |r| message.from.email =~ r }
        
      autolabel message, label
    end
  end

  unless message.nil?
    autolabel_email   message,    /ucdavis.edu$/i,     'ucdavis'
    # … lines similar to above, giving regexes or arrays of regexes and the
    # desired label.
  end

-- 
med vänlig hälsning
David J. Hamilton
_______________________________________________
sup-talk mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-talk

---

From: Philippe LeCavalier <[email-masked]>
Date: Mon, 14 Feb 2011 14:18:38 -0500

Hi David.
> run in to with your attempts at autolabeling?

Yeah. I've tried a bunch of options[1] -and still am-. Mostly, I don't understand what's going on during the functions and it's making things challenging to say the least.

I really like the idea of matching email addresses using an external file as in the sup-wiki. As I mention in [1] simple operations ie adding/removing a single label works like a charm. But I want a model that will allow me to search in a very granular way. I want to break down my labels.

|client
||companyA
||companyB
||companyC
|||position
|||invoice
|||issues
|||reports

|ff #friends and foe
||wife,friends, family
|||contact
||||persons name I don't like

This way I can search for all 'company' then refine by 'position' 'invoice'...etc. Or go straight to a specific group or people 'position' ie all 'exec' or 'finance'. But in order to do that I need a before-add-message hook that will add multiple labels either in one invocation or multiple ones.

It goes without saying, but I'll state it anyways, my desired model far exceeds my ability as non-programmer. However, I'm a logical and patience individual and I know that if I can find a working example I can 'take it from there'.

At the moment, it seems my biggest problem is labeling an email more than once. I found a few posts/relevant discussions[2,3] regard sup and multiple labels but nothing has lead me down the correct path.

ref:
[1] http://rubyforge.org/pipermail/sup-talk/2011-February/004504.html
[2] https://github.com/jacius/sup-filters/blob/master/filters.example.yaml
[3] http://www.mail-archive.com/[email-masked]/msg03361.html
-- 
Thanks,
Phil

---

From: Philippe LeCavalier <[email-masked]>
Date: Sun, 13 Feb 2011 15:57:30 -0500

Well, despite not finding a truly efficient method for autolabeling my mail -I'm not worried I won't, I just haven't found it yet- after 30 some days of due deligence my inbox is for now back to 0.

I think this speaks volumes about just how good Sup is considering I did this mostly by selecting a thread, highlight a contact(this really should be mentioned in a wiki somewhere), S, T, =, L, <various labels seperated by whitespaces starting with '-inbox'>

This wasn't as painful as it may sound. In fact it was almost enjoyable. To put things into perspective; I started the day out with approx. ten thousand msgs left in my inbox and it's ten to four. Considering I prob. spent every other hour entertaining the kids I prob. spent a three to four hours.

I almost crossed over to notmuch just yesterday but I stuck with Sup and I'm glad I did.

Cheers!