procmail
[Top] [All Lists]

Re: process a maildir-folder

2008-04-28 11:39:45
On Mon, Apr 28, 2008 at 9:34 AM, Raphael Brunner 
<trance202(_at_)gmail(_dot_)com> wrote:

 how can I process a maildir (!) folder with mails to procmail?

A maildir folder is just a directory full of (subdirectories full of)
files with one message per file.  Process it like you'd process any
other directory tree of files.  For example, how would you process a
directory tree with "grep"?

The one complication is that procmail will ONLY handle a message on
standard input, so you have to introduce a redirection operation once
you've identified the file names.

In my shell (zsh) I'd just type this:

  for message in /tmp/mailbox/**/cur/*(.); procmail < $message

Most people, however, are probably using bash or ksh and would have to
resort to something more like this:

  find /tmp/mailbox \( -name new -o -name tmp \) -prune -o -type -f
-exec sh -c 'procmail < {}' \;

You might want to process the files in the new/ subdirectories too, in
which case drop the "-name new -o" from the find.
____________________________________________________________
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

<Prev in Thread] Current Thread [Next in Thread>