procmail
[Top] [All Lists]

RE: Nesting block: deliver to folder AND inbox?

2008-12-12 12:08:45
I wrote: 

With directory delivery, procmail allows multiple delivery targets
on the action line.  It links them automatically.  This is cool,
for one because you can use it to create "legacy"-style procmail dirs
without having to ensure the dir existed already first.

bash-3.2$ cat rc
 :0
 foo/ bar

This actually has some nifty implications.  E.g.:

1) If I make the action line as above, directory "bar" will be created
   automatically[1] (as will the maildir+ directory "foo"); the message
   will be linked as a single message under foo saved in procmail's
   "legacy"-dir format using $MSGPREFIX as the beginning string for
   the message.  (See "man procmailrc".)

   However, the message won't have a From_ line, because the
   style of message creation defaults to the precedence listed
   for delivery -- and maildir+ messages typically don't have
   a From_ line.

2) If we reverse the order of "bar foo/" on the action line,
   we don't get an automatic directory creation for "bar";
   procmail would deliver in traditional mbox format to
   flat mail-folder "bar", creating that file if it did not
   exists.  The link-save to foo/ will not occur.  This is
   not optimal, for one, because the action line seems to
   document a delivery that won't happen right, and for two,
   because we'd want a lockfile on the recipe when delivering
   to mbox-folder "bar" in that case.

   However: we can turn this around.  If we are sure that
   directory "bar" already exists, then the reversed order --
   legacy-directory delivery and then maildir+ delivery --
   via a single action-line works nicely.  The two files
   created in differing mail formats are still links of
   one another, but now they have a From_ line!  That
   does not seem to bother the two text-based MUAs I
   tried under Unix.  I like this!  I can have IMAP-accessible
   maildir+ folders linked automatically to legacy folder-
   delivery in one swell foop.  I will do it!  And I will
   set MSGPREFIX to a useful string based on what procmail
   finds in the message.


[1] But if flat-file "bar" already exists, well, then procmail won't
be able to create a dir of the same name, obviously.  It will then
simply deliver to maildir+ folder "foo/" and quit.


____________________________________________________________
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