Just insert something similar in your ~/.procmailrc file. Some warnings:

make sure that your MAILDIR directory exists;

make sure you have a default entry at the end of the file (in the example, the inbox.spool)

For nnmaildir backend

The ~/.procmailrc looks very similar:

MAILDIR=$HOME/Mail
# set the following to yes for debugging
VERBOSE=no
# to enable logging
# LOGFILE=$HOME/.procmaillog
DEFAULT=$MAILDIR/inbox/

#all
:0:
* ^TOall@mycompany\.com
$MAILDIR/company-all/

#eng-stuff
:0:
* ^TOeng-stuff@mycompany\.com
$MAILDIR/eng-stuff/

.
.
# Accept all the rest to your default mailbox
:0:
${DEFAULT}

Important to note that trailing slash (/) at the end of each procmail destination.

Note: This last “accept all” rule is the default behavior for procmail: anything not matched by another rule will be saved in $DEFAULT. – JohnWiegley

Configuring Gnus

Ok, now all you have to do is to tell Gnus that it shall get the mail from the ~/.mail/ directory. This directory will contain the *.spool files where the mail is stored. The following line will do the job:

(setq mail-sources '((directory :path "~/.mail" :suffix ".spool")))

Then, add the following in order to Gnus delete the files that were created by procmail (they are not needed anymore):

(setq mail-source-delete-incoming t)

And that’s it! You do not need to use any of the split functionalities that Gnus offers.

Discussions

Does ‘procmail’ help improving speed comparing to Gnus’ split method? I’ve always be annoyed by fetching new mails from /var/mail/user (with fetchmail), which takes quite some time. - WilliamXu

Not only is procmail faster, but it usually happens in the background and thus the time taken is not perceived by the user at all. You don’t get the fancy Lisp options that you do with Gnus splitting, but I prefer the speed. – JohnWiegley

This work is licensed to you under version 2 of the
GNUGeneral Public License.
Alternatively, you may choose to receive this work under any other
license that grants the right to use, copy, modify, and/or distribute
the work, as long as that license imposes the restriction that
derivative works have to grant the same rights and impose the same
restriction. For example, you may choose to receive this work under
the
GNUFree Documentation License, the
CreativeCommonsShareAlike
License, the XEmacs manual license, or
similar licenses.