[imapfilter-devel] fetchtext... storetext?

David DeSimone fox at verio.net
Sun Jun 13 10:28:02 EEST 2004


Hello, I am a new imapfilter user.

Currently I am using fetchmail to pull my mail from an IMAP server, run
it through procmail for filtering, and store it locally.  However, I
would really prefer to leave my mail on the IMAP server instead, and I
have found imapfilter as an excellent candidate for doing just that.

I have managed to find good substitutes for nearly all of my current
procmail rules, but I am curious about two things:

1.  I would like to use spamassassin to detect and filter spam messages
    and send them to a folder for storage.

2.  I would like to make some changes to some of the headers of incoming
    messages.


One way to implement spamassassin is to use the fetchtext() and
pipe_to() methods, piping each message to the "spamc -c" program, and
then checking the returned exitvalue to decide whether the message
should move to another folder or not.  However, this solution loses some
of spamassassin's functionality (such as producing a spam report and
making it part of the message).  If I am curious how spamassassin scored
a message, I would have to do extra work.. but this may be acceptable.

However, in the second case, I cannot see any way to do it.  Let me give
an example:

I often receive mailing list messages that look like this:

    Subject: [mailing-list-message] Some mail from mailing-list about "xyz"

In each case, the junk at the start of the Subject is the same, so when
there are several of these in a mailbox, the subjects are usually cut
off, and it looks like this:

    Subject: [mailing-list-message] Some mail from mailing-list abou
    Subject: [mailing-list-message] Some mail from mailing-list abou
    Subject: [mailing-list-message] Some mail from mailing-list abou

For this case I have a procmail rule that modifies the subject, removing
the constant parts and producing subjects that can be easily read at a
glance:

    Subject: xyz
    Subject: Re: xyz
    Subject: abc

I can use imapfilter's fetchheader() method to grab the headers I want,
but it seems there is no corresponding storeheader() method that will
allow me to replace the modified headers back on the message.  Is this
functionality planned for a future version of imapfilter?  Or maybe it
is available but I missed it somehow?

It occurs to me that if I had "store" methods to match the "fetch"
methods, that I could also better solve my spamassassin problem, by
letting spamassassin modify the message and then let me store the
modified message back to the IMAP server.

Is anyone else doing similar things with imapfilter?  I have seen some
amazing examples already posted to this list.  Thanks very much for
sharing.  :)

-- 
David DeSimone || "It took me fifteen years to discover that I had no
 Network Admin ||  talent for writing, but I couldn't give it up because
 fox at verio.net ||  by that time I was too famous.  -- Robert Benchley




More information about the Imapfilter-devel mailing list