This section has some tips and tricks to help make your .maildelivery setup better.
Precedence: bulk Precedence: junkYou can catch that mail with entries like this:
precedence,bulk,|,A,"/x/y/rcvstore +later -seq bulkmail" precedence,junk,|,A,"/x/y/rcvstore +later -seq bulkmail"The messages will be automatically filed into the later folder and added to the bulkmail sequence in that folder.
... To: jerry X-auto-m-p: monthly reportYour .maildelivery file could match that message reliably with the entry:
x-auto-m-p "monthly report" ^ R "/x/y/rcvpack reports"If special fields are out of the question, special words or characters in the To: or Subject: field can do it. For instance, these message header fields have special text:
To: ajones, email@example.com (Jerry-report-archiver), bsmith, ... To: ajones, "Jerry-report-archiver" <firstname.lastname@example.org>, bsmith, ...The mail will be delivered to email@example.com. The comment will come along with the address and be matched in this .maildelivery entry:
to jerry-report-archiver ^ R "/x/y/rcvpack reports"
# store book questions to handle later: to bookquestions ^ A "/x/y/rcvstore +bookq" cc bookquestions ^ A "/x/y/rcvstore +bookq" resent-to bookquestions ^ A "/x/y/rcvstore +bookq" # process book-info subscriptions: to book-info-request | A "/u/jerry/bin/book-info-proc" cc book-info-request | A "/u/jerry/bin/book-info-proc" resent-to book-info-request | A "/u/jerry/bin/book-info-proc" ...If you don't care what address was used, it's much easier to use an * (asterisk) or default:
... # put everything else in my $HOME/.mailbox file: default - > ? .mailbox
For example, here are some of the system aliases I'm on at ora.com:
Jerry.Peek: jerry bookquestions: jerry, eric authors: ..., jerry, ...If someone sends mail to Jerry.Peek, bookquestions, or authors, it'll be delivered to my jerry mailbox. I can separate that mail with .maildelivery entries like these:
to bookquestions ^ A "/x/y/rcvdist firstname.lastname@example.org" default - > ? /usr/spool/mail/jerryThe first entry would resend all bookquestions mail to email@example.com, but leave the rest of the mail in my system mailbox.
If I wanted to resend all my mail (to bookquestions, Jerry.Peek, authors, or plain jerry), an entry like this would not do it:
to jerry ^ A "/x/y/rcvdist firstname.lastname@example.org" ...wrongInstead, to match all mail sent to my mailbox, no matter what alias, I'd use the addr field (or just a default or *):
addr jerry ^ A "/x/y/rcvdist email@example.com"Of course, an easier way to forward all my mail is by putting firstname.lastname@example.org in my .forward file. But this addr example applies to any command, not just resending with rcvdist.
For instance, tell people to put the word "urgent" somewhere in the Subject: of your important mail. This entry in .maildelivery will find those messages:
subject urgent ^ R "/x/y/rcvdist email@example.com"
Example: .maildelivery that routes to several places
# Route all mail from Jim Shankland or Laura Enz to +wordy folder; # also tell Mark about them so he can check when he has time: from,firstname.lastname@example.org,|,R,"/bin/echo \"Mail ($(size) characters!) from Jim Shankland.\" | /bin/mail markw" from,email@example.com,^,A,"/x/y/rcvstore +wordy" from,firstname.lastname@example.org,|,R,"/bin/echo \"Mail ($(size) characters!) from Laura Enz.\" | /bin/mail markw" from,email@example.com,^,A,"/x/y/rcvstore +wordy" # Send first 200 lines of undelivered mail to roady. # Don't mark it delivered, so it'll also go to lines below: default,-,|,R,"/x/y/mhl -form mhl.roady -nomoreproc | /bin/sed -e 200q | /x/y/rcvdist firstname.lastname@example.org" # Send complete copy of all undelivered mail to my system mailbox: default,-,>,?,/usr/mail/rhondaThat long rcvdist pipeline above is interesting. It filters mail sent to the roady computer (a laptop PC with dialup UUCP used to get mail from wherever she's traveling around the world) to make sure that no very long messages waste modem time on international long-distance -- or fill up her disk. (All messages are copied, full length, to her system mailbox.) First in the pipe is mhl with a filter file that strips out fields she won't need on the road. The Example below shows the mhl.roady file in her MH directory. Next, sed truncates any message more than 200 lines long. Finally, rcvdist sends what's left to her UUCP address.
Because the rcvdist pipeline uses the default field, it won't send messages from the long-winded people. The rcvdist entry uses the R result, so it will always send undelivered messages to roady. But the last entry uses the ? (question mark) result, so the only messages written to her system mailbox will be the ones that weren't already filed in the wordy folder.
This file is in the book's online archive, too.
Example: mhl.roady file filters junk before distributing mail
width=10000 ignores=received,mmdf-warning,x-face Date: From: To: cc: Subject: extras:nocomponent : body:nocomponent
[Table of Contents] [Index] [Previous: Alternatives to mhook Programs] [Next: Debugging Tips]
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 <email@example.com>