The mail-mode is a mode for writing mails. It’s useful when you use Emacs as mail/news editor for other programs (e.g. mutt, slrn, tin).
The mail-mode is defined in sendmail.el which is part of Emacs and included in the mail-lib package of XEmacs.
To active the mode just type
Here are some typical settings:
(add-hook 'mail-mode-hook 'turn-on-auto-fill) (add-hook 'mail-mode-hook 'mail-abbrevs-setup) (setq mail-yank-prefix "> " mail-signature "\n\n-- \nhttp://www.emacswiki.org/cgi-bin/wiki/AlexSchroeder" mail-default-headers "FCC: ~/SENT\n")
Emacs sets up your buffer initially with some mail headers. You can modify, remove, or add to those before sending; the setup is just for your convenience. Your mail setup hook (mail-setup-hook) can set up some of these headers - it runs before Emacs adds its own.
Starting in Emacs 22, one of the header mail sets up automatically is From:. If you don’t want it to do this (perhaps because you would rather do it with your mail setup hook, perhaps because your pre-Emacs 22 environment is already set up to do that), set mail-setup_with_from to nil.
If you want to have the lines of an e-mail colorized differently depending on how many levels of quoting (instead of just one color for all quoted text), you can use this hook (after you’ve defined the faces):
(add-hook 'mail-mode-hook (lambda () (font-lock-add-keywords nil '(("^[ \t]*>[ \t]*>[ \t]*>.*$" (0 'mail-multiply-quoted-text-face)) ("^[ \t]*>[ \t]*>.*$" (0 'mail-double-quoted-text-face))))))
See sending mail for more.