3.7 Various Message Variables


Symbol naming a MIME charset. Non-ASCII characters in messages are assumed to be encoded using this charset. The default is iso-8859-1 on non-MULE Emacsen; otherwise nil, which means ask the user. (This variable is used only on non-MULE Emacsen.) See Charset Translation in Emacs MIME Manual, for details on the MULE-to-MIME translation process.


Local value for the column beyond which automatic line-wrapping should happen for message buffers. If non-nil (the default), also turn on auto-fill in message buffers.


Regexp matching the signature separator. It is ‘^-- *$’ by default.


String used to separate the headers from the body. It is ‘--text follows this line--’ by default.


Directory used by many mailish things. The default is ~/Mail/. All other mail file variables are derived from message-directory.


Directory where Message auto-saves buffers if Gnus isn’t running. If nil, Message won’t auto-save. The default is ~/Mail/drafts/.


Hook run when initializing the message buffer. It is run after the headers have been inserted but before the signature has been inserted.


Hook run as the last thing when the message buffer has been initialized, but before yanked text is inserted.


Hook called narrowed to the headers after initializing the headers.

For instance, if you’re running Gnus and wish to insert a ‘Mail-Copies-To’ header in all your news articles and all messages you send to mailing lists, you could do something like the following:

(defun my-message-header-setup-hook ()
  (let ((group (or gnus-newsgroup-name "")))
    (when (or (message-fetch-field "newsgroups")
              (gnus-group-find-parameter group 'to-address)
              (gnus-group-find-parameter group 'to-list))
      (insert "Mail-Copies-To: never\n"))))

(add-hook 'message-header-setup-hook

Hook run before sending messages.

If you want to add certain headers before sending, you can use the message-add-header function in this hook. For instance:

(add-hook 'message-send-hook 'my-message-add-content)
(defun my-message-add-content ()
  (message-add-header "X-In-No-Sense: Nonsense")
  (message-add-header "X-Whatever: no"))

This function won’t add the header if the header is already present.


Hook run before sending mail messages. This hook is run very late: just before the message is actually sent as mail.


Hook run before sending news messages. This hook is run very late: just before the message is actually sent as news.


Hook run after sending messages.


Hook run when canceling news articles.


Syntax table used in message mode buffers.


If non-nil, don’t strip quoted text from articles that have ‘X-No-Archive’ set. Even if this variable isn’t set, you can undo the stripping by hitting the undo keystroke.


Emacs has a number of special text properties which can break message composing in various ways. If this option is set, message will strip these properties from the message composition buffer. However, some packages requires these properties to be present in order to work. If you use one of these packages, turn this option off, and hope the message composition doesn’t break too bad.


Alist of ways to send outgoing messages. Each element has the form:

(type predicate function)

A symbol that names the method.


A function called without any parameters to determine whether the message is a message of type type. The function will be called in the buffer where the message is.


A function to be called if predicate returns non-nil. function is called with one parameter—the prefix.

The default is:

((news message-news-p message-send-via-news)
 (mail message-mail-p message-send-via-mail))

The message-news-p function returns non-nil if the message looks like news, and the message-send-via-news function sends the message according to the message-send-news-function variable (see News Variables). The message-mail-p function returns non-nil if the message looks like mail, and the message-send-via-mail function sends the message according to the message-send-mail-function variable (see Mail Variables).

All the elements in this alist will be tried in order, so a message containing both a valid ‘Newsgroups’ header and a valid ‘To’ header, for example, will be sent as news, and then as mail.