NOTE: for users of the online version of this book: This section has a lot of examples followed by long explanations. To avoid jumping between the example and its explanation, it's a good idea to open a new browser window to show an example. (Check your browser's menu for a command like New Web Browser or Open in New Window). Then, use the original browser to read the explanation while you view the example in the second browser window.
Without a .maildelivery file, when new mail arrives, your computer's MTA drops it in your system mailbox. The entries you put in your .maildelivery file will control what happens instead. This section gives an overview. The Section The .maildelivery File in Detail has more info.
NOTE: You should not perform the steps in this section, to set up your .maildelivery file, yet. Instead, give the file another name. When you're ready to use the file, follow the instructions in the Section Running Your .maildelivery File for enabling the file. Rename your temporary version to .maildelivery then.
When a new message comes in, the .maildelivery file is read entry by entry, from top to bottom. If an entry matches the incoming message, an action on the entry stores the message in a file or passes the message to a command listed on that entry. Then, in most cases, the message will be flagged as "delivered." Following entries in .maildelivery can test whether the message has been delivered by a previous entry.
The system is fairly easy to understand and set up. It's not as flexible as you might want it to be, but you can work around most of the problems.
Let's look at the simple .maildelivery file in the next Example. The line numbers to the left of each line (like 2>) are not part of the file; they are for reference only. Entries starting with a hash mark (#) are comments that explain the following entry. Comments aren't required, but they're a good idea! (You can also get the file, without line numbers, from this book's online archive. It's in download/split/mh/misc/maildelivery-1.)
Example: Simple .maildelivery file
1> # Throw away all mail from this guy: 2> from email@example.com destroy A - 3> # File VAX mailing list in +vax folder; I read it later: 4> subject "vax digest" qpipe A "/x/y/rcvstore +vax" 5> # Put the rest into my maildrop: 6> default - file ? /usr/spool/mail/jerryIn general:
The /x/y is the absolute pathname of the directory that holds the rcvstore program. See the NOTE in the Section The .maildelivery File in Detail.
[Table of Contents] [Index] [Previous: MH Format Strings] [Next: The .maildelivery File in Detail]
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 <firstname.lastname@example.org>