head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2006.05.29.14.31.25; author jpeek; state Exp; branches; next 1.3; 1.3 date 2006.05.28.04.27.15; author jpeek; state Exp; branches; next 1.2; 1.2 date 2006.05.26.23.59.01; author jpeek; state Exp; branches; next 1.1; 1.1 date 2006.05.26.22.12.08; author jpeek; state Exp; branches; next ; desc @mh-e_50.html page from mh-e section of "MH & nmh: Email for Users & Programmers" @ 1.4 log @Removed 'html/' from end of http://mh-e.sourceforge.net/manual/html/ URLs @ text @ BOOK MOVED: mh-e - Customizing Sending

BOOK MOVED: mh-e - Customizing Sending

This section of MH & nmh: Email for Users & Programmers is now the MH-E Manual. It's moved to http://mh-e.sourceforge.net/manual/.

If you aren't taken to the new site in 15 seconds, please click on the link above.

You may also want to visit:


Last change $Date: 2006/05/28 04:27:15 $
Suggestions are welcome: Bill Wohler <wohler@@newt.com>
@ 1.3 log @removed 'Tour-Through-MH_002dE.html' from end of http://mh-e.sourceforge.net/manual/html/ @ text @d4 1 a4 1 content="15;URL=http://mh-e.sourceforge.net/manual/html/"> d15 2 a16 2 href="http://mh-e.sourceforge.net/manual/html/"> http://mh-e.sourceforge.net/manual/html/. d39 1 a39 1 Last change $Date: 2006/05/26 23:59:01 $ @ 1.2 log @Replaced with page pointing people to new MH-E Manual @ text @d4 1 a4 1 content="15;URL=http://mh-e.sourceforge.net/manual/html/Tour-Through-MH_002dE.html"> d15 2 a16 2 href="http://mh-e.sourceforge.net/manual/html/Tour-Through-MH_002dE.html"> http://mh-e.sourceforge.net/manual/html/Tour-Through-MH_002dE.html. d39 1 a39 1 Last change $Date: 2006/05/26 22:12:05 $ @ 1.1 log @Original version from Feb 19 2001 @ text @d3 2 d7 39 a45 171 mh-e - Customizing Sending Go to the first, previous, next, last section, table of contents.


Sending Mail

You may wish to start off by adding the following useful key bindings to your `.emacs' file:

(global-set-key "\C-xm" 'mh-smail)
(global-set-key "\C-x4m" 'mh-smail-other-window)

In addition, several variables are useful when sending mail or replying to mail. They are summarized in the following table.

mh-comp-formfile
Format file for drafts (default: `"components"').
mh-repl-formfile
Format file for replies (default: `"replcomps"').
mh-letter-mode-hook
Functions to run in MH-Letter mode (default: nil).
mh-compose-letter-function
Functions to run when starting a new draft (default: nil).
mh-reply-default-reply-to
Whom reply goes to (default: nil).
mh-forward-subject-format
Format string for forwarded message subject (default: `"%s: %s"').
mh-redist-full-contents
send requires entire message (default: nil).
mh-new-draft-cleaned-headers
Remove these header fields from re-edited draft (default: `"^Date:\\| ^Received:\\| ^Message-Id:\\| ^From:\\| ^Sender:\\| ^Delivery-Date:\\| ^Return-Path:"').

Since mh-e does not use comp to create the initial draft, you need to set mh-comp-formfile to the name of your components file if it isn't `components'. This is the name of the file that contains the form for composing messages. If it does not contain an absolute pathname, mh-e searches for the file first in your MH directory and then in the system MH library directory (such as `/usr/local/lib/mh'). Replies, on the other hand, are built using repl. You can change the location of the field file from the default of `replcomps' by modifying mh-repl-formfile.

Two hooks are provided to run commands on your freshly created draft. The first hook, mh-letter-mode-hook, allows you to do some processing before editing a letter. For example, you may wish to modify the header after repl has done its work, or you may have a complicated `components' file and need to tell mh-e where the cursor should go. Here's an example of how you would use this hook--all of the other hooks are set in this fashion as well.

Prepare draft for editing via mh-letter-mode-hook

(defvar letter-mode-init-done nil
  "Non-nil when one-time mh-e settings have made.")

(defun my-mh-letter-mode-hook ()
  "Hook to prepare letter for editing."
  (if (not letter-mode-init-done)    ; only need to bind the keys once
      (progn
        (local-set-key "\C-ctb" 'add-enriched-text)
        (local-set-key "\C-cti" 'add-enriched-text)
        (local-set-key "\C-ctf" 'add-enriched-text)
        (local-set-key "\C-cts" 'add-enriched-text)
        (local-set-key "\C-ctB" 'add-enriched-text)
        (local-set-key "\C-ctu" 'add-enriched-text)
        (local-set-key "\C-ctc" 'add-enriched-text)
        (setq letter-mode-init-done t)))
  (setq fill-prefix "  ")            ; I find indented text easier to read
  (save-excursion
    (goto-char (point-max))          ; go to end of message to
    (mh-insert-signature)))          ;   insert signature

(add-hook 'mh-letter-mode-hook 'my-mh-letter-mode-hook)

The function, add-enriched-text is defined in the example in section Editing Multimedia Messages.

The second hook, a function really, is mh-compose-letter-function. Like mh-letter-mode-hook, it is called just before editing a new message; however, it is the last function called before you edit your message. The consequence of this is that you can write a function to write and send the message for you. This function is passed three arguments: the contents of the `To:', `Subject:', and `cc:' header fields.


Go to the first, previous, next, last section, table of contents. @