Rich Lafferty's LiveJournal (mendel) wrote,
Rich Lafferty's LiveJournal

  • Mood:

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:


    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.


  • New Year's resolution

    I'm going to post this on my zen blog later this week, but right now I want to post it somewhere and I'm too tired to compose a post over…

  • how's this work again

    So uh hi there everyone, long time no see? So I've got this theory where I think it'd be good for me to just write about stuff that's going on here,…

  • o hai lj.

    I should totally start using this again.

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded