Storing in Folders: rcvstore

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

The rcvstore program will store a message in an MH folder. (It's handy from a shell prompt, too; see below.) You can use rcvstore to presort some or all of your incoming messages by the person or mailing list they come from, by certain words in the Subject:, and so on. Give the folder name (only one folder at a time) on the rcvstore command line. For example, if you're on your system's managers alias and you want to save all messages sent to managers in your read_now folder:

to   managers   ^   A   "/x/y/rcvstore +read_now"
Of course, if you use an R result instead of the A, a copy of the message will be put in the folder but it won't be marked "delivered" -- so the message can also be delivered by other .maildelivery entries.

By default, if you give rcvstore a folder name that doesn't exist, it will create the folder. With the -nocreate switch, if a folder doesn't exist, rcvstore will exit without storing the message.

When rcvstore puts a message in a folder, it can also add the message to an MH sequence. You might have all your messages dropped into inbox folder automatically -- but added to different sequences, depending on some rules you choose. Also, if the Unseen sequence is defined in your MH profile, rcvstore will add new messages to it.

CAUTION: rcvstore does not do any context locking when it updates sequences. You can lose all of your sequences in (rare) cases. If your system has good nightly backups of the filesystems, and unless you make heavy use of sequences, you probably don't need to worry very much.

Here's an example. The first two entries below store messages sent to managers or from cert into the inbox folder and its readnow sequence. The third entry stores messages with a subject that includes "status report" into inbox and its reports sequence:

to,managers,^,A,"/x/y/rcvstore +inbox -seq readnow"
from,cert,^,A,"/x/y/rcvstore +inbox -seq readnow"
subject,"status report",^,A,"/x/y/rcvstore +inbox -seq reports"
Remember that a folder can't have more than 26 sequences (and, on older versions of MH and on some small systems, only 10 sequences).

The rcvstore command is useful for copying any message file into a MH folder quickly. Just pipe or redirect the file to rcvstore's standard input. For example, Usenet news articles are in the same format as mail messages. When I read a message I want to save in my src folder, I can do it with rcvstore at an rn prompt:

End of article 89 (of 99) -- what next? [npq] |rcvstore +src
(I don't have to type the full pathname, like /usr/local/lib/mh/rcvstore, because I've added that directory to my shell's search path. For more about search paths, see the Section Making a bin Directory, Setting Search Path.)

[Table of Contents] [Index] [Previous: New Message Notification: rcvtty] [Next: Redistributing Messages: rcvdist]


Last change $Date: 1996/06/06 15:14:25 $

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 <jpeek@jpeek.com>