www.delorie.com/gnu/docs/emacs/mh-e_50.html   search  
 
Buy the book!


mh-e

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 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. The default is:
 
"^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 3.3.2 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.

3.2.1 Replying to Mail  
3.2.2 Forwarding Mail  
3.2.3 Redistributing Your Mail  
3.2.4 Editing Old Drafts and Bounced Messages  


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003