$book = '..'?>include "$book/mh.php"; includeHeader('usmwp.html', 'ch-smwm.html'); ?>
The Chapter Processing New Mail Automatically shows the mhook features for processing each new message automatically as it comes in. Some systems won't allow users to run "mail hook" programs as mail comes in. Some users might want to process mail in a batch, to have a program (or themselves) make decisions about what to do with the mail as a group. The autoinc script in this book's online archive can be adapted to do that kind of mail processing. It's designed to be run automatically from a cron or at job, but you can also type its name at a shell prompt.
Here's how it works. First, autoinc compares the amount of incoming mail you have to your disk quota. If you don't have enough room, it sends mail to some address (probably not yours!) to complain. Next, autoinc incorporates your new mail and starts a loop to scan the messages one by one. An MH format string) lets scan pull out just the information you need. The script refiles messages it knows what to do with. It leaves the rest of the mail in your inbox for you to look at. The only output you see from autoinc is the scan lines that inc makes as it incorporates new mail; the refiling is done silently.
With the techniques in the Chapter Introduction to UNIX Programming with MH, the power of all the MH commands, as well as all the other utilities on your UNIX system, you can probably make autoinc do just what you need. This Section shows how to set up autoinc. includeFooter('$Date: 2006-05-31 15:13:43 -0700 (Wed, 31 May 2006) $', 'OReilly: 1991, 1992, 1995'); ?>