The slocal program is part of MH/nmh. It uses a filter specification file .maildelivery in your home directory. Filtering is done based on strings that appear in mail headers. There are several things you can do with a message, but generally you file it into a folder where exmh will find it as unread.
There are two ways to integrate slocal and exmh:
Integration with exmh - .forward file
To run slocal from your .forward file, add a line like this to it:
| /usr/lib/nmh/slocal -user username
In this case you want exmh to look for mail in the background with Flist. You can set up Flist as a background action under background processing. flist is also an MH program you can run from the command line to report on which folders have unseen messages.
Integration with exmh - presort or presort-multi
If you select presort style under Incorporate Mail preferences, then exmh will inc your mail into a MyIncTmp folder, and then run slocal against each message found there. Afterwards it will automatically highlight the folders that contain unseen messages.
If you select 'presort-multi style under Incorporate Mail preferences, then exmh will consult your .xmhcheck file for a list of hosts to contact via POP for mail. It will pull all the mail into the MyIncTmp folder and sort it with slocal, and then highlight the new mail. See [POP and exmh] for details about fetching mail via POP.
The .maildelivery filter file
Here are the first few lines of my ~/.maildelivery file. (Note that some versions of MH insist that this file is only writable by your account.) Primarily I just use + rules that cause mail to be put into folders. However, you can also run programs against mail, or file them into mbox files.
#field value action result command #----- ----- ------ ------ ------- #* - + R allmail delivered-to brent.welch@interwoven + ? urgent delivered-to welch@scriptics + ? urgent delivered-to welch@ajubasolutions + ? urgent # code red worm content-type "Outlook_Express_message_boundary" qpipe ? "/usr/bin/tclsh8.0 bin/codered.tcl" to admin@lists.sourceforge + ? urgent subject Xconq + ? xconq from P4 + ? p4 from perforce@ + ? p4 from welch@panasas + ? inbox from bugzilla + ? bugs from @panasas + ? panasas # IMPORTANT to have a default rule at the end default - + ? default
The first column is a mail header, and the second column is a case-insensitive sub-string that must appear in that mail header for the rule to apply. In addition to normal headers, there are some special fields:
Each rule has an action:
Each rule has a result that determines if a rule should be applied, and if so, if the message should be considered delivered. You'll see that it is possible for more than one rule to be applied to a message.
The complete description of the maildelivery file can be found in the mhook man page.
When you are starting out, you probably want most things to go to your inbox, with a few exceptions. The following .maildelivery will put mail from addresses in my company to its own folder, and everything else to inbox:
#field value action result command from @panasas + ? panasas default - + ? inbox