On Thu, 23 Oct 2014 18:00:29 -0400
"Kevin A. McGrail" <kmcgr...@pccc.com> wrote:

> Procmail has some weird syntax

Procmail is also unmaintained abandonware, as far as I can tell.
If you use SpamAssassin, you probably like Perl, so I would recommend
Email::Filter instead.  It's far more flexible than procmail and lets
you write readable filters.

Since procmail is still the default LDA on Debian, this is my .procmailrc:

:0
| /usr/bin/perl /home/dfs/.mail-filter.pl >> /home/dfs/.mail-filter.log 2>&1

And excerpts from my filter look something like this:

# ...
my $REC = strftime('%Y-%m', localtime(time));
my $p = '/var/imap/dfs';

my $h = $m->header('RT-Ticket');
if (defined($h) && ($h =~ /roaringpenguin\.com/)) {
        my $r_to = $m->header('Reply-To');
        if (defined($r_to) && ($r_to =~ 
/invoices(-comment)?\@roaringpenguin\.com/)) {
                accept_mail("InvoiceTickets");
        } else {
                accept_mail("Tickets");
        }
}


accept_mail("LicenseKeys") if $m->subject =~ /^(Annual|Perpetual) license key 
generated for/ && mail_for(qr/provision_request/);
accept_mail("Buildbot") if $m->subject =~ /^buildbot success/;
accept_mail("Buildbot") if $m->subject =~ /^buildbot failure/;

$m->accept("$p/Received-Archive/$REC");

which I find far more readable than .procmailrc recipes.

Regards,

David.

Reply via email to