Writing mail filters for Notes


I am in the process of porting a mail filter which I originally wrote in Perl using Mail::Audit to LotusScript for use in Notes.

I’ve now got an Enterprise Blackberry, which means I can’t store my mail on the old e-smith IMAP server anymore, and there’s always been pressure for me to use Notes so I can handle meeting requests the same way everyone else does. But my mail volume tends to be higher than most users, somewhere around a thousand messages a day (and primarily machine-generated), so I’ve come to rely on a mail workflow which processes incoming mail heavily before I ever see it: sorting into folders, forward some messages to the ‘berry, coloring messages in Mutt by importance and age, sorting specific folders differently than others, viewing threads grouped together, and so on, just to make reading mail not take up my whole day.

Moving to Notes made all of that go away, but I’ve managed to finagle IMAP access which at least lets me read my mail in Mutt instead of in the Notes client (which, incidentally, is incapable of quoting mail normally; you must top-post!) except when I have to use a Notes-client feature like calendaring or document links. But Notes R5’s mail rules feature is flaky and impractical: it has no “deliver and then stop processing here” action (resulting in messages being sorted into multiple mailboxes, which then work like hard links), and has a WONTFIX known issue where the internal numbering of the mail rules gets out of order, develops gaps, and even manages to store numbers as the wrong data type, leading to rules firing only occasionally and unpredictably. That won’t cut it at all, and I can’t afford that sort of productivity drop, and I definitely can’t afford to miss messages that required attention.

So instead of using the filters, I can write myself an agent in LotusScript which will do the same thing that my old Mail::Audit filter will do, like so:

Before:

    use Mail::Audit;
    my $m = Mail::Audit->new;
    $m->accept("IN.cron") if $m->subject =~ /Cron </;

After, something like:

    Sub Initialize
        Dim session As New NotesSession
        Dim m As NotesDocument
      
        Set session = New NotesSession
        Set m = session.DocumentContext
    
        If Instr(1, m.subject(0), "Cron <") Then
            Call m.PutInFolder( "IN.cron" )
            Call m.RemoveFromFolder("($InBox)")
        End If
    
    End Sub

Not pretty, but it’ll do. I couldn’t imagine using Notes without access to things like agents and IMAP, though.

There’s an option in Domino Designer to write in Java instead of LotusScript. I should probably investigate that.


2 responses to “Writing mail filters for Notes”

  1. Sweet jeebus, I wondered who used Notes.
    (Besides, formerly, the Ministry of Transportation of Ontario.)

    Not that Exchange is a ton better.

  2. There are people who go to school for years just to be Notes administrators. It’s the kind of product that would not exist were it not for the proliferation of PHBs in the world; there’s simply no reason to use something so terrible.

    Notes is the kind of product which allows me to assign the following adjective to MS Exchange, something which in a normal world would be inconceivable: “better”.