$book = '..'?>include "$book/mh.php"; includeHeader('altmhpr.html', 'debugti.html'); ?>
This section has some tips and tricks to help make your .maildelivery setup better.
A lot of mailing lists put one of these fields in their messages:
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.
Do you get a certain message regularly or automatically that you want to be sure your .maildelivery file identifies correctly? The best answer, if it's possible, is to put a unique field in the message. (The Section Draft Message Template Files shows how to do that in MH.) For example, if the message header has:
... 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"
Mail can come to you via the fields To:, cc:, Resent-To:, Apparently-To:, and more. If it's important to know exactly what address was used -- for instance, if you can get mail through several system aliases (as shown in Section System Aliases, the to and addr Fields) -- then you should consider testing all of those fields and more in your .maildelivery file:
# 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
If your name is listed in the system mail alias file, people can send you mail without addressing it to your username. On most systems, that alias name stays in the message header, so you can test for it in your .maildelivery file.
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.
If you can't read all your mail for some reason -- you're out of your office, unusually busy, or whatever -- you can ask people who send you important messages to mark them "urgent." Your .maildelivery file can catch those messages and handle them specially: forward them to you on the road, use rcvtty to alert you, print them on your secretary's printer (the Section Printing Incoming Mail), or whatever.
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"
If you're on the road, you don't have to give people a list of the email addresses where they can find you on certain days. Tell them to send to your normal address; let your .maildelivery file send the important mail (with rcvdist) to wherever you are. Each time you move, you or someone in your office can edit your .maildelivery file to forward mail to your new location. Your .maildelivery file can be set to forward only some of your mail; the rest can stay in your system mailbox or be forwarded to someone else.
The next Example is a .maildelivery file that I worked out for a friend. It has a combination of ideas for splitting messages into a few places automatically. (You can also get the file from this book's online archive. It's in examples/mh/misc/maildelivery-2.)
Example: .maildelivery that routes to
# 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. It's in
Example: mhl.roady file filters junk before
width=10000 ignores=received,mmdf-warning,x-face Date: From: To: cc: Subject: extras:nocomponent : body:nocomponentincludeFooter('$Date: 2006-05-31 15:13:43 -0700 (Wed, 31 May 2006) $', 'OReilly: 1991, 1992, 1995; Jerry: 1996, 1997, 1999, 2000, 2002, 2004'); ?>