procmail
[Top] [All Lists]

RE: Interlocking log output and LOGABSTRACT?

2003-12-30 00:30:14

As a follow-up, the problem that I was originally trying to solve was to
write
info. into the procmail log which indicated who the mail was originally
from,
and have this info. appear next to the associated mail summary that is
written
by LOGABSTRACT (and 'formail -l'). For example,

REALLY FROM: Gary Funck <gary(_at_)intrepid(_dot_)com>
From procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE  Sun Dec 28 
23:45:39 2003
 Subject: RE: Interlocking log output and LOGABSTRACT?
  Folder: procmail-mail            6707


In my case, I'm actually not all that interested in the intermediary
(in this case procmail-bounces(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE), and 
would in fact
prefer to see the following in the log:

From Gary Funck <gary(_at_)intrepid(_dot_)com>  Sun Dec 28 23:45:39 2003
 Subject: RE: Interlocking log output and LOGABSTRACT?
  Folder: procmail-mail            6707

Here is the solution that I've come up with:

TRAP='formail -I "From " | formail -l "$LASTFOLDER"'

placed near the top of the procmailrc file, ahead of any delivery actions.

The first formail invocation removes the leading "From " header and
the second one will add a new "From " header back, using the info
from the From: line, which is the REALLY_FROM address that I was logging
before, and this is the info. that the -l switch will use in its mail
summary. The message size logged in the message summary after the folder
name will be close but not necessarily the same as the size of the actual
delivered message, becuase the "From:" address may
be different than the "From " address in the message as delivered. Since
I don't use that size info. any way; I'm not worried about this small source
of inaccuracy.

It isn't efficient (it involves two executions of formail, and a new
shell(?),
but it gives the output that I'm looking for.



_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail