Batch-process New Mail: autoinc

[previous] [next] [table of contents] [index]

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.

[Table of Contents] [Index] [Previous: Using MH with POP] [Next: Chapter Introduction: Sending Mail with MH]


Last change $Date: 1996/06/06 15:12:10 $

This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.

Suggestions are welcome: Jerry Peek <jerry@ora.com>

HIVE: All information for read only. Please respect copyright!
Hosted by hive КГБ: Киевская городская библиотека