The Section Regular Expression Matching with rcvsearch has an overview of rcvsearch. Here is the rcvsearch script (you might want to open it in a separate browser window). To install it, see the Section Programs in This Book's Archive.
The script is simple; it doesn't need to be configured. It's designed to be run from a .maildelivery file. It reads a complete email message (header and body, separated by a blank line) from its standard input into a temporary file. If an egrep search using the first command-line argument ($1) fails, the script fails and returns an exit status of 20. Otherwise, the script runs the program named in the second command-line argument ($2) and passes any other command-line arguments to that program. When that program finishes, its exit status is passed to slocal; a zero status means that slocal can consider the message "delivered."
Of course, you can adapt the program to do different searches. If you want to do a series of specific searches, for example, you could give rcvsearch multiple names, one for each search; that could avoid passing messy command-line arguments.
This file first appeared in the updated online edition of the book MH & nmh: Email for Users & Programmers, by Jerry Peek. It 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 COPYING.
Copyright © 1997 Jerry Peek
Last modified: 2006-05-31 15:13:43 -0700