Koozali.org: home of the SME Server

procmail log and verbose

Chris B

procmail log and verbose
« on: January 28, 2003, 12:41:21 AM »
Is there a way to get a bit more info in the pocmail.log file. I am looking for something between VERBOSE=no and VERBOSE=yes in .promailrc.

With 'no' we get the Subject, Size, and where the message went. I would like to add another header or two to the list without the full verbose. (Like the From, and one of the spamassassin headers.)

Thanks for the info.

Rich Lafferty

Re: procmail log and verbose
« Reply #1 on: January 28, 2003, 12:49:59 AM »
Yes, but it's not that straightforward. You can set the 'TRAP' variable
to the path of a program that will have the message piped to it when
mail arrived, and then that program can append to the procmail log.
Icky, but it works.

In .procmailrc:

  TRAP=$HOME/.procmail/TRAP

In ~/.procmail/TRAP, something like:

perl -e '
$header = 1;
while (<>) {
    print "    $_" if /^From:/ and $header;
    print "      $_" if /^To:/ and $header;
    print "  $_" if s/^Message-ID:/Msg-ID:/i and $header;
    $lines++ unless $header;
    $header = 0 if /^$/;

};
print "   Lines: $lines\n";
'

Rich Lafferty

Re: procmail log and verbose
« Reply #2 on: January 28, 2003, 01:05:02 AM »
Woops, that was unclear. Procmail executes TRAP when it exits,
providing the mail message on STDIN, and writing whatever it gets
on STDOUT to the logfile -- you don't have to append to the logfile
directly in the program.