Incorporating Mail - The MH-E Manual
Description: The MH-E Manual

Next: Reading Mail, Previous: Using This Manual, Up: Top

## 5 Incorporating Your Mail

This chapter talks about getting mail from your system mailbox into your MH ``+inbox`' folder. The following command accomplishes that and is found in the ``Folder`' menu.

`i`
  Incorporate new mail into a folder (`mh-inc-folder`).

The following options in the ``mh-inc`' customization group are used.

`mh-inc-prog`
  Program to incorporate mail (default: `"inc"`).
`mh-inc-spool-list`
  Alternate spool files (default: `nil`).

The following hook is available.

`mh-inc-folder-hook`
  Hook run by `mh-inc-folder` after incorporating mail into a folder (default: `nil`).

If at any time you receive new mail, incorporate the new mail into your ``+inbox`' buffer with `i` (`mh-inc-folder`). Note that `i` will display the ``+inbox`' buffer, even if there isn't any new mail. You can incorporate mail from any file into the current folder by specifying a prefix argument; you'll be prompted for the name of the file to use as well as the destination folder (for example, `C-u i ~/mbox <RET> +tmp <RET>`).

Emacs can notify you when you have new mail by displaying ``Mail`' in the mode line. To enable this behavior, and to have a clock in the mode line as well, add the following to `~/.emacs`:

         (display-time)

The name of the program that incorporates new mail is stored in `mh-inc-prog`; it is `"inc"` by default. This program generates a one-line summary for each of the new messages. Unless it is an absolute pathname, the file is assumed to be in the `mh-progs` directory (see Getting Started). You may also link a file to `inc` that uses a different format (see ``mh-profile`'(5), and sections Reading Mail: inc show next prev and MH Format Strings in the MH book). You'll then need to modify several variables appropriately (see Scan Line Formats).

You can use the `mh-inc-spool-list` variable to direct MH-E to retrieve mail from arbitrary spool files other than your system mailbox, file it in folders other than your ``+inbox`', and assign key bindings to incorporate this mail.

Suppose you are subscribed to the mh-e-devel mailing list and you use `procmail` to filter this mail into `~/mail/mh-e` with the following recipe in `.procmailrc`:

         PATH=$PATH:/usr/bin/mh
         MAILDIR=$HOME/`mhparam Path`
         :0:
         * ^From mh-e-devel-admin@stop.mail-abuse.org
         mh-e

In order to incorporate `~/mail/mh-e` into ``+mh-e`' with an `I m` (`mh-inc-spool-mh-e`) command, customize this option, and click on the ``INS`' button. Enter a ``Spool File`' of ``~/mail/mh-e`', a ``Folder`' of ``mh-e`', and a ``Key Binding`' of ``m`'.

You can use `xbuffy` to automate the incorporation of this mail using the Emacs 22 command `emacsclient` as follows:

         box ~/mail/mh-e
             title mh-e
             origMode
             polltime 10
             headertime 0
             command emacsclient --eval '(mh-inc-spool-mh-e)'

In XEmacs, the command `gnuclient` is used in a similar fashion.

You can set the hook `mh-inc-folder-hook`, which is called after new mail is incorporated by the `i` (`mh-inc-folder`) command. A good use of this hook is to rescan the whole folder either after running `M-x mh-rmail` the first time or when you've changed the message numbers from outside of MH-E.

         (defun my-mh-inc-folder-hook ()
           "Hook to rescan folder after incorporating mail."
           (if (buffer-modified-p)            ; if outstanding refiles and deletes,
               (mh-execute-commands))         ;   carry them out
           (mh-rescan-folder)                 ; synchronize with +inbox
           (mh-show))                         ; show the current message

         (add-hook 'mh-inc-folder-hook 'my-mh-inc-folder-hook)

         Rescan folder after incorporating new mail via mh-inc-folder-hook