Re: ProcMail, WAS: Re: Fetchmail and Gmail
On Tue, Aug 25 2009, Andrei Popescu wrote:
> On Mon,24.Aug.09, 20:56:27, Paul Cartwright wrote:
>
>> but looking at the procmailrc( now non-existant), then thinking about my 200
>> kmail filters, I'm not sure I could tackle that task..
>
> maildir (and procmail too as I hear, but I don't like its syntax) is
> *very* powerful. I recently did a major rewrite on my maildrop rules. I
> had one rule for each Debian list, now I have exactly one:
>
> # These are the lists.debian.org lists
> if (/^List-Id:.*<debian-(.*)\.lists.debian.org>/)
> {
> to Maildir/.debian.$MATCH1
> }
>
> Similar for googlegroups, alioth, ... All that was needed was a bit of
> folder renaming ;)
Hmm. Here is my Debian section; this pulls out emails for my
packages from the pts, discards all other devel-changes mail; pulls
out boring debbugs email, send bugs for my package into a package
specific folder, pulls out mail sent to bugs I reported separately,
and then files every debian group to a separate folder.
Oh, I used to separate out ballots and votes, etc, but that is
mostly done away with.
After mailagent, procmail seems ... underpowered.
manoj
######################################################################
######################################################################
# #
# Debian #
# #
######################################################################
######################################################################
######################################################################
<INITIAL> X-PTS-Package: /([-\w]+)/
{ ANNOTATE -d X-Agent-list 'pkg-%1';
ASSIGN list 'pkg-%1';
REJECT MailingList };
# X-Mailing-List To Resent-From Resent-To Resent-Reply-To Cc
<INITIAL> X-Loop: /debian-devel-changes/i { REJECT JUNK; };
# Do not wish to see acks for bug reports
<INITIAL> From: /owner\@bugs.debian.org/, Subject: /Bug#\d+: Acknowledgement /
{ REJECT JUNK; };
# These have little information really
<INITIAL> From: /owner\@bugs.debian.org/, Subject: /Bug#\d+: Info received/i
{ REJECT ClosedBugs };
<INITIAL> X-Loop: /debian-bugs-dist/i { REJECT DEBIANBUGS };
<INITIAL> X-Loop: /owner\@bugs.debian.org/i { REJECT DEBIANBUGS };
<INITIAL> X-Loop X-Mailing-List To Resent-From Resent-To Resent-Reply-To Cc:
/lists.debian.org/i { REJECT DEBIAN };
<INITIAL> X-Loop X-Mailing-List To Resent-From Resent-To Resent-Reply-To Cc:
/debian-ctte/i { REJECT DEBIAN };
<INITIAL> X-Loop: /deity/i { ASSIGN list deity; REJECT MailingList };
<INITIAL> Sender From: /installer\@ftp-master.debian.org/
{ ASSIGN list 'installed'; REJECT MailingList };
# Handle My own bugs
<DEBIANBUGS> To Resent-CC: /Manoj Srivastava/
{ REJECT MYBUGS };
<MYBUGS> X-Debian-PR-Package: /([-\w]+)/
{ ANNOTATE -d X-Agent-list 'pkg-%1';
ASSIGN list 'pkg-%1';
REJECT MailingList };
# Resent-To: Manoj Srivastava is for bugs I reported
<MYBUGS> /./
{ ASSIGN list 'debian';
ANNOTATE -d X-Agent-list unknown-bug-list;
REJECT MailingList;
};
#handle policy bugs
<DEBIANBUGS> X-Debian-PR-Package: /debian-policy/
{ ASSIGN list 'debian-policy';
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<DEBIANBUGS> X-Debian-PR-Package: /general/
{ ASSIGN list 'debian-devel';
ANNOTATE -d X-Agent-list general-bugs;
REJECT MailingList;
};
<DEBIANBUGS> X-Debian-PR-Package: /wnpp/
{ ASSIGN list 'wnpp';
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<DEBIANBUGS> Subject: /\[proposal\]/i, X-Debian-PR-Package: /debian-policy/
{ ASSIGN list 'debian-policy';
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<DEBIANBUGS> All: /./
{
ASSIGN list 'debian-bugs';
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<DEBIAN> X-Loop:
/(debian-bugs-(closed|forwarded))(-(request|dist))?\@lists.debian.org/i
{ REJECT ClosedBugs };
<DEBIAN> X-Loop X-Mailing-List To Resent-From Resent-To Resent-Reply-To Cc :
/(debian-ctte+)(-(request|dist|private))?\@debian.org/gi
{ ASSIGN list '%1';
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<DEBIAN> Subject: /CFV: Proposal/, X-Loop: /debian-vote/ { REJECT VOTE };
<DEBIAN> X-Loop: /(debian-[\w-]+)(-(request|dist))?\@lists.debian.org/gi
{ ASSIGN list '%1';
SUBST #list /-(digest|request|dist)//gi;
SUBST #list /devel-changes/changes/i;
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<VOTE> Body: /^\s*I vote\s+\w+\s+on/i
{ UNIQUE -a (vote); VACATION off; MESSAGE ~/etc/mail/voteack;
REJECT VOTEACK; };
<VOTE> All: /./ { REJECT DEBIAN };
<DEBIAN> X-Loop X-Mailing-List To Resent-From Resent-To Resent-Reply-To Cc :
/(debian-[\w-]+)(-(request|dist))?\@lists.debian.org/gi
{ ASSIGN list '%1';
SUBST #list /-(digest|request|dist)//gi;
SUBST #list /devel-changes/changes/i;
ANNOTATE -d X-Agent-list debian-list;
REJECT MailingList;
};
<DEBIAN> X-Loop X-Mailing-List To Resent-From Resent-To Resent-Reply-To Cc:
/srivasta/ { ANNOTATE -d X-Agent-list Unknown;
ASSIGN list 'debian'; REJECT MailingList };
<DEBIAN> All: /./ { ANNOTATE -d X-Agent-list Unknown;
REJECT RETRY};
<ClosedBugs> {
## construct text string suitable for single-quoting
ASSIGN temp %[From]%_=>%_%[Envelope-To]%_(%[Subject]);
SUBST #temp /['\\\\]/\\\\$1/g;
## now write the log
DO add_log ("[$mfile]%_".'%#temp');
PERL sbin/mailagent.deblog.pl;
};
<MailingList> All: /./
{ TR #list /A-Z/a-z/; PERL sbin/mailagent.archive.pl %#list %H %Y %m; };
<MailingList> All: /./ { VACATION off; TR #list /A-Z/a-z/;
UNIQUE -a (%#list);
ANNOTATE -d X-MYLIST %#list.spool; SAVE %#list.spool
};
--
"Good health" is merely the slowest rate at which one can die.
Manoj Srivastava <srivasta@acm.org> <http://www.golden-gryphon.com/>
1024D/BF24424C print 4966 F272 D093 B493 410B 924B 21BA DABB BF24 424C
Reply to: