;;; message.el --- composing mail and news messages ;; Copyright (C) 1996, 1997, 1998, 1999, 2000 ;; Free Software Foundation, Inc. ;; Author: Lars Magne Ingebrigtsen ;; Keywords: mail, news ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; This mode provides mail-sending facilities from within Emacs. It ;; consists mainly of large chunks of code from the sendmail.el, ;; gnus-msg.el and rnewspost.el files. ;;; Code: (eval-when-compile (require 'cl)) (require 'mailheader) (require 'nnheader) (require 'easymenu) (if (string-match "XEmacs\\|Lucid" emacs-version) (require 'mail-abbrevs) (require 'mailabbrev)) (require 'mail-parse) (require 'mm-bodies) (require 'mm-encode) (require 'mml) (defgroup message '((user-mail-address custom-variable) (user-full-name custom-variable)) "Mail and news message composing." :link '(custom-manual "(message)Top") :group 'mail :group 'news) (put 'user-mail-address 'custom-type 'string) (put 'user-full-name 'custom-type 'string) (defgroup message-various nil "Various Message Variables" :link '(custom-manual "(message)Various Message Variables") :group 'message) (defgroup message-buffers nil "Message Buffers" :link '(custom-manual "(message)Message Buffers") :group 'message) (defgroup message-sending nil "Message Sending" :link '(custom-manual "(message)Sending Variables") :group 'message) (defgroup message-interface nil "Message Interface" :link '(custom-manual "(message)Interface") :group 'message) (defgroup message-forwarding nil "Message Forwarding" :link '(custom-manual "(message)Forwarding") :group 'message-interface) (defgroup message-insertion nil "Message Insertion" :link '(custom-manual "(message)Insertion") :group 'message) (defgroup message-headers nil "Message Headers" :link '(custom-manual "(message)Message Headers") :group 'message) (defgroup message-news nil "Composing News Messages" :group 'message) (defgroup message-mail nil "Composing Mail Messages" :group 'message) (defgroup message-faces nil "Faces used for message composing." :group 'message :group 'faces) (defcustom message-directory "~/Mail/" "*Directory from which all other mail file variables are derived." :group 'message-various :type 'directory) (defcustom message-max-buffers 10 "*How many buffers to keep before starting to kill them off." :group 'message-buffers :type 'integer) (defcustom message-send-rename-function nil "Function called to rename the buffer after sending it." :group 'message-buffers :type 'function) (defcustom message-fcc-handler-function 'message-output "*A function called to save outgoing articles. This function will be called with the name of the file to store the article in. The default function is `message-output' which saves in Unix mailbox format." :type '(radio (function-item message-output) (function :tag "Other")) :group 'message-sending) (defcustom message-courtesy-message "The following message is a courtesy copy of an article\nthat has been posted to %s as well.\n\n" "*This is inserted at the start of a mailed copy of a posted message. If the string contains the format spec \"%s\", the Newsgroups the article has been posted to will be inserted there. If this variable is nil, no such courtesy message will be added." :group 'message-sending :type 'string) (defcustom message-ignored-bounced-headers "^\\(Received\\|Return-Path\\):" "*Regexp that matches headers to be removed in resent bounced mail." :group 'message-interface :type 'regexp) ;;;###autoload (defcustom message-from-style 'default "*Specifies how \"From\" headers look. If `nil', they contain just the return address like: king@grassland.com If `parens', they look like: king@grassland.com (Elvis Parsley) If `angles', they look like: Elvis Parsley Otherwise, most addresses look like `angles', but they look like `parens' if `angles' would need quoting and `parens' would not." :type '(choice (const :tag "simple" nil) (const parens) (const angles) (const default)) :group 'message-headers) (defcustom message-syntax-checks nil ;; Guess this one shouldn't be easy to customize... "*Controls what syntax checks should not be performed on outgoing posts. To disable checking of long signatures, for instance, add `(signature . disabled)' to this list. Don't touch this variable unless you really know what you're doing. Checks include subject-cmsg multiple-headers sendsys message-id from long-lines control-chars size new-text redirected-followup signature approved sender empty empty-headers message-id from subject shorten-followup-to existing-newsgroups buffer-file-name unchanged newsgroups." :group 'message-news :type '(repeat sexp)) (defcustom message-required-news-headers '(From Newsgroups Subject Date Message-ID (optional . Organization) Lines (optional . User-Agent)) "*Headers to be generated or prompted for when posting an article. RFC977 and RFC1036 require From, Date, Newsgroups, Subject, Message-ID. Organization, Lines, In-Reply-To, Expires, and User-Agent are optional. If don't you want message to insert some header, remove it from this list." :group 'message-news :group 'message-headers :type '(repeat sexp)) (defcustom message-required-mail-headers '(From Subject Date (optional . In-Reply-To) Message-ID Lines (optional . User-Agent)) "*Headers to be generated or prompted for when mailing a message. RFC822 required that From, Date, To, Subject and Message-ID be included. Organization, Lines and User-Agent are optional." :group 'message-mail :group 'message-headers :type '(repeat sexp)) (defcustom message-deletable-headers '(Message-ID Date Lines) "Headers to be deleted if they already exist and were generated by message previously." :group 'message-headers :type 'sexp) (defcustom message-ignored-news-headers "^NNTP-Posting-Host:\\|^Xref:\\|^[BGF]cc:\\|^Resent-Fcc:" "*Regexp of headers to be removed unconditionally before posting." :group 'message-news :group 'message-headers :type 'regexp) (defcustom message-ignored-mail-headers "^[GF]cc:\\|^Resent-Fcc:\\|^Xref:" "*Regexp of headers to be removed unconditionally before mailing." :group 'message-mail :group 'message-headers :type 'regexp) (defcustom message-ignored-supersedes-headers "^Path:\\|^Date\\|^NNTP-Posting-Host:\\|^Xref:\\|^Lines:\\|^Received:\\|^X-From-Line:\\|^X-Trace:\\|^X-Complaints-To:\\|Return-Path:\\|^Supersedes:\\|^NNTP-Posting-Date:\\|^X-Trace:\\|^X-Complaints-To:" "*Header lines matching this regexp will be deleted before posting. It's best to delete old Path and Date headers before posting to avoid any confusion." :group 'message-interface :type 'regexp) (defcustom message-subject-re-regexp "^[ \t]*\\([Rr][Ee]:[ \t]*\\)*[ \t]*" "*Regexp matching \"Re: \" in the subject line." :group 'message-various :type 'regexp) ;;;###autoload (defcustom message-signature-separator "^-- *$" "Regexp matching the signature separator." :type 'regexp :group 'message-various) (defcustom message-elide-ellipsis "\n[...]\n\n" "*The string which is inserted for elided text." :type 'string :group 'message-various) (defcustom message-interactive nil "Non-nil means when sending a message wait for and display errors. nil means let mailer mail back a message to report errors." :group 'message-sending