Procmail recipes for Maildir folders

A procmail recipe checks each message for the characteristic(s) that you specify and then disposes of the message accordingly.

Each Maildir++ folder is actually a directory, or, more accurately, a directory subtree. Each message is a separate file. You have to be careful to specify the right type of folder, and to make sure you get the path the way you want.

If you have MAILDIR set to $HOME/.maildir, the following recipe will save any message with "Testing" in the Subject: line to a folder that shows up from webmail or IMAP as "testing":

:0
* ^Subject:.*\<testing
.testing/

Note that the folder name begins with a dot (which is necessary so that the folder is visible to the IMAP server) and ends with a slash (which is necessary to tell procmail that it's saving to the maildir++ format).

If you have MAILDIR set to $HOME/mail, you can still save mail to $HOME/.maildir/.testing this way:

:0
* ^Subject:.*\<testing
$HOME/.maildir/.testing/

Again, note that the foldername has to begin with a dot and end with a slash.

Note that there is no colon after the zero on the first line of each of these recipes. As each message is a distinct file, there is no need for a lock.

You will note that matching upper and lower case isn't important. This recipe will not match mail with "contesting" or "protesting" in the subject line because of the \<, which marks the beginning of a word boundary.



Last Modified:Wednesday, 30-Jan-2013 12:14:10 EST
© Copyright 2006-2021 Public Access Networks Corporation