Next: Odds and Ends, Previous: Scan Line Formats, Up: Top

## Appendix B Reading Mailing Lists Effectively

This appendix explains how to use procmail to file mail from mailing lists into folders which can then be read easily with MH-E1. Some mailing lists have such high traffic that Gnus must be used and I discuss how to use Gnus side-by-side with MH-E.

First, I'll describe how to put mail from your mailing lists directly into an MH folder using `procmail`. First, add the following to `~/.procmailrc`. While the logging variables aren't strictly necessary, they are extremely useful.

         [1]  # Update PATH so procmail can find myrcvstore, rcvstore and mhparam.
         [2]  PATH=$PATH:/usr/lib/mh:/usr/bin/mh:$HOME/bin
         [3]
         [4]  # Point LOGFILE at the actual log file.
         [5]  LOGFILE=$HOME/.procmail.log
         [6]
         [7]  # This setting provides just the right amount of information.
         [8]  LOGABSTRACT=all
         [9]
         [10] # Uncomment the following line to see how your patterns match.
         [11] #VERBOSE=yes
         [12]
         [13] # Place mail sent to any MH-E mailing list in +mh-e.
         [14] :0 w: mh-e$LOCKEXT
         [15] * ^TO.*mh-e-.*.*sourceforge.net
         [16] | myrcvstore -create +mh-e

Line 14 creates a lock file in your mail directory based upon the name of the folder. This is done because `rcvstore` does not perform locking. While this lock file will prevent `procmail` from writing to a folder concurrently, there is a slight chance that you might lose a message if you're performing operations on a folder at the same time `rcvstore` is placing a message there. You have been warned. Now that that disclaimer is out of the way, note that I've been using this set-up for over a decade and haven't lost anything to my knowledge2.

Line 16 uses the following script, `myrcvstore`, to massage the message as described in the comment and file the message in the given folder3.

         #! /bin/sh

         # Accepts a message on standard input and passes it through rcvstore
         # after first passing it through any filters. All arguments are passed
         # on to rcvstore.

         # Force the "From user date" to become part of header. One reason this
         # is done is because the presence of the From field confuses dist so
         # that dist adds a new header, rather than using the existing header.
         # Note that this should not be done for any message that goes into a
         # Gnus incoming file (Gnus will thrown an error) nor should it be
         # applied to any message that goes to the system mailbox because the
         # entire mailbox will be incorporated as a single message.
         formail -c -z -R 'From ' X-Envelope-From: |
         rcvstore $@

If your version of `rcvstore` doesn't add messages to the ‘`unseen`’ sequence by default, add the following line to your MH profile:

         Unseen-Sequence: unseen

Now view your new messages with the speedbar (see Speedbar) or with `F n` (`mh-index-new-messages`). See Folders.

If you're on a mailing list that is so voluminous that it is impossible to read every message, it usually better to read the mailing list like a newsgroup in a news reader. Emacs has a built-in newsreader called Gnus. The remainder of this appendix talks about how to use Gnus with an MH message store. The version of Gnus that was used to prepare this manual was 5.10. Versions 5.8 through 5.10 should work but versions prior to 5.8 use different options.

This table contains a list of Gnus options that you will have to modify. Note that for them to become accessible, you'll have to load `nnml.el` first. This can be done with `M-x load-library <RET> nnml <RET>`.

`gnus-secondary-select-methods`
  Select the ‘`nnml`’ value. This select method uses directories for folders and individual files for messages, just like MH. You do not have to set an address.
`mail-sources`
  Select the ‘`Several files in a directory`’ value, check the ‘`Path`’ box and enter `~/Mail` to tell Gnus where to find your mail.
`message-mail-user-agent`
  In order to send mail within Gnus using MH-E, set this option to ‘`mail-user-agent`’ and set the `mail-user-agent` option to ‘`Emacs interface to MH`’.
`nnmail-keep-last-article`
  Since Gnus keeps track of which messages you have read, it would be bad if Gnus expired the last message, for example, message 100, and `rcvstore` gave the next new message number 1. Gnus would then ignore it since it thinks that you've read messages 1-100. Turning on this option ensures that the last message is never removed thereby eliminating this problem.

Next add the following to `~/.procmailrc`. If you don't subscribe to the GnuCash mailing list, substitute one to which you are subscribed.

         PATH=$PATH:/usr/bin/mh
         MAILDIR=$HOME/`mhparam Path`
         # Place mail sent to the GnuCash mailing list in gnucash.spool, where
         # Gnus will pick it up.
         :0:
         * ^TO.*gnucash.*.*gnucash.org
         gnucash.spool

Wait for some messages to appear in `gnucash.spool` and run Gnus with `M-x gnus <RET>`. To view the folder created in the example above, you would tell Gnus about it the first time only with `G m gnucash <RET> nnml <RET>`. In MH-E, this folder is known as ‘`+gnucash`’.

#### Footnotes

[1] The MH equivalent, `slocal`, can be used as well, but procmail is more flexible and more packages exist for procmail than for slocal.

[2] See Savannah issue #4361 to see if `rcvstore` locking is still an issue.

[3] The ‘`-create`’ argument wasn't always the default to `rcvstore`.