procmail
[Top] [All Lists]

Re: Can procmail deliver to mbox and maildir for the same user?

2005-01-14 08:47:55
Toen wij NM Public kietelden, kwam er dit uit:
Del Stoliker:

I'd like to configure procmail to
deliver mail to both the user's mbox located at
/var/spool/mail/$user and maildir located at ~/Maildir for a while
in case I need to fail back over to the original server setup.  Is
this possible? Practical? Crazy?

It's not crazy at all and should be straightforward. Something
like this should work:

:0 c:
/var/spool/mail/$LOGNAME

:0
$HOME/Maildir/


An alternative is to do it with 1 recipe:

  :0c
  $HOME/Maildir/

because $DEFAULT will take care of the delivery of the original message
to the usual place.


A safety net can be added (for when $HOME has problems)

  :0c
  {
    MAILDIR = "$HOME/Maildir"  # procmail's chdir
    :0
    * ! MAILDIR ?? ^^[.]^^
    ./
    :0
    |call-somebody
    :0
    /dev/null
  }


The 'c' on the first recipe means 'continue processing this
message even if it is delivered by this recipe'

An alternative is to read the 'c' as 'copy' or 'clone'. An
extra procmail-process is started, which gets a copy (of
the current state) of the message.

Any changes made inside the {}-block that follows, do not
change the parent-message. (So 'c' can also be read as child,
but that might blur delivery.)

Often, the copy-message is delivered in that {}-block,
otherwise you would end up with 2 copies (actually 1 original
and 1 copy) delivered to the same place.
(Which happens to everybody, now and then.)

-- 
Grtz, Ruud


____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail