Looks like the patch is also interesting for some other users.
Hello!
As discussed in the previous thread about "Dovecot deliver logging problem
and procmail" I have made a small patch for procmail to deliver through
dovecot's deliver program (or any other delivery program).
So Procmail does not write the mailboxes directly any more. So delivery is
done through pipes and an external program which can deliver the files.
Since dovecot's deliver program can not handle absolute pathes, theses files
are handled directly by procmail. See the configuration options below for
details.
Also INBOX handling needs special handling because this is handled through
the /var/spool/mail/$LOGNAME folder which dovecot deliver can not handle. So
this is mapped (when configured) to the INBOX folder.
For debugging purposes you can add the VERBOSE=on variable. A sample
configuration for dovecot usage with documentation is discussed below. Some
other delivery agents (e.g. cyrus) might need other options.
Keep in mind that the environment expansions with $ in the DELIVER_PROGRAM
must be escaped with a backslash. BOXNAME and RECIPIENT are 2 new variables
which can be used.
Status of the patch is that it "works for me". There is no other guarantee
...
So I hope you like the patch. Maybe someone can make a short review of the
code changes.
Feel free for any feedback.
Ciao,
Gerhard
############################################################################
#Set on when debugging
VERBOSE=on
#Replace `mail' with your mail directory (Pine uses mail, Elm uses Mail)
MAILDIR=$HOME/Mail
#Directory for storing procmail log and rc files
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
##############################################################################
Alternate delivery options through external program
##############################################################################
#######################
Options for Mailboxes
#######################
Possibilites for Mailboxes:
Mailbox is INBOX
1.) Deliver through mbox
2.) Deliver through external delivery program
Mailbox has an absolute path
1.) Deliver through mbox
2.) Deliver through external delivery program
###############
INBOX options
###############
When set, delivers the INBOX throuh the external program
When not set, absolute path mailboxes are delivered through procmail.
DELIVER_INBOX=yes
When set and the mailbox is the INBOX (e.g. /var/spool/mail/$LOGNAME)
it is replaced with a custom string (default INBOX)
DELIVER_REPLACE_INBOX_NAME=yes
When DELIVER_REPLACE_INBOX_NAME is set the mailbox name is replaced with
INBOX (default) or when DELIVER_NEW_INBOX_NAME is set, this name is used
DELIVER_NEW_INBOX_NAME=INBOX
#######################
Absoulte Path options
#######################
When set, absolute path mailboxes are delivered through the external
program
When not set, absolute path mailboxes are delivered through procmail.
#DELIVER_ABSOLUTE_PATH=yes
##################
Delivery options
##################
Do not lock anything even the rule has a lock assigned
DELIVER_PIPE_NO_LOCK=yes
Deliver in raw mode even the rule flag states that it should be delivered
in raw mode
DELIVER_RAW_MODE=yes
When set, remove the first From line of the mbox file through the external
program
DELIVER_REMOVE_FROM=yes
################
Global options
################
When set and the mail ends in a folder it is piped through the program
Global Switch for enabling alternate delivery method
All environment variables can be used with \$NAME
\$BOXNAME is the name of the mailbox (maybe converted to the rules
discussed above)
\$RECIPIENT is the recipient name, typically the user name
DELIVER_PROGRAM="/usr/libexec/dovecot/deliver -m \$BOXNAME -d \$RECIPIENT -c
/etc/dovecot.conf"
:0
$DEFAULT