right now in the non verbose log procmail is not logging who the recipient is. It is just logging who the sender is, the subject, date and the delivery.
From [email protected] Tue Apr 15 20:33:19 2014
Subject: ***** SPAM 7.3 ***** Foto
Folder: /usr/lib/dovecot/deliver -d christian -m Junk 132417
Where can I configure to include the To and the CC into the logfile ?
You simply assign the strings you want to log to the LOG
pseudo-variable.
Usually you want to add a newline explicitly. Something like this:
NL="
"
TO=`formail -zxTo:`
Cc=`formail -zxCc:`
LOG=" To: $TO$NL Cc: $CC$NL"
These will usually end up before the "log abstract" (what you have in your question). If you need full control over what gets logged, maybe set LOGABSTRACT=no
and implement your own log abstract instead. (This is fairly tricky, though.)
Note also that logging could be asynchronous. The log abstract gets written all at once, but if you have many messages arriving at roughly the same time, you might want to add disambiguating information to the log entries, or (in desperation) force locking during logging so that no two messages can perform logging at the same time.
LOCKFILE=procmail.lock
# Critical section -- only one Procmail instance at a time can execute these recipes
LOG="fnord$NL"
:0w
| /usr/lib/dovecot/deliver -d "$USER" -m "$FOLDER"
# delivery succeeded, lockfile will be released
The disambiguating information could be just the process ID. In order to include it in the log abstract also, you need to smuggle it in somehow. Not sure how to do that with Dovecot, is there an option you can pass in which will simply be ignored but logged by Procmail?
TO=`formail -zxTo:`
LOG="[$$] To: $TO$NL"
CC=`formail -zxCc:`
LOG="[$$] Cc: $CC$NL"
:
:
# deliver
:0w
| deliver -d "$USER" -m "$FOLDER" -o ignore=$$
... should end up logging something like Folder: deliver -d you -m INBOX -o ignore=1742
where 1742 would be the process-ID so that you can find the same PID in the previous log entries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With