;;; sendmail.el --- mail sending commands for Emacs. -*- byte-compile-dynamic: t -*-
;; Copyright (C) 1985, 1986, 1992, 1993, 1994, 1995, 1996, 1998, 2000,
-;; 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;; 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
;; Maintainer: FSF
;; Keywords: mail
;; 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)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
:group 'sendmail
:version "22.1")
+(defcustom sendmail-program
+ (cond
+ ((file-exists-p "/usr/sbin/sendmail") "/usr/sbin/sendmail")
+ ((file-exists-p "/usr/lib/sendmail") "/usr/lib/sendmail")
+ ((file-exists-p "/usr/ucblib/sendmail") "/usr/ucblib/sendmail")
+ (t "fakemail")) ;In ../etc, to interface to /bin/mail.
+ "Program used to send messages."
+ :group 'mail
+ :type 'file)
+
;;;###autoload
(defcustom mail-from-style 'angles
"Specifies how \"From:\" fields look.
:type 'boolean
:group 'sendmail)
-;;;###autoload
(defcustom mail-yank-ignored-headers
(concat "^"
(regexp-opt '("via" "mail-from" "origin" "status" "remailed"
:type 'regexp
:group 'sendmail)
+;; Prevent problems with `window-system' not having the correct value
+;; when loaddefs.el is loaded. `custom-reevaluate-setting' needs the
+;; standard value.
+;;;###autoload
+(put 'send-mail-function 'standard-value
+ '((if (and window-system (memq system-type '(darwin windows-nt)))
+ 'mailclient-send-it
+ 'sendmail-send-it)))
+
;; Useful to set in site-init.el
;;;###autoload
(defcustom send-mail-function
(define-derived-mode mail-mode text-mode "Mail"
"Major mode for editing mail to be sent.
Like Text Mode but with these additional commands:
-\\[mail-send] mail-send (send the message) \\[mail-send-and-exit] mail-send-and-exit
+
+\\[mail-send] mail-send (send the message)
+\\[mail-send-and-exit] mail-send-and-exit (send the message and exit)
+
Here are commands that move to a header field (and create it if there isn't):
- \\[mail-to] move to To: \\[mail-subject] move to Subject:
- \\[mail-cc] move to CC: \\[mail-bcc] move to BCC:
+ \\[mail-to] move to To: \\[mail-subject] move to Subj:
+ \\[mail-bcc] move to BCC: \\[mail-cc] move to CC:
\\[mail-fcc] move to FCC: \\[mail-reply-to] move to Reply-To:
\\[mail-mail-reply-to] move to Mail-Reply-To:
\\[mail-mail-followup-to] move to Mail-Followup-To:
-\\[mail-text] mail-text (move to beginning of message text).
+\\[mail-text] move to message text.
\\[mail-signature] mail-signature (insert `mail-signature-file' file).
\\[mail-yank-original] mail-yank-original (insert current message, in Rmail).
\\[mail-fill-yanked-message] mail-fill-yanked-message (fill what was yanked).
-\\[mail-sent-via] mail-sent-via (add a Sent-via field for each To or CC).
+\\[mail-sent-via] mail-sent-via (add a sent-via field for each To or CC).
Turning on Mail mode runs the normal hooks `text-mode-hook' and
`mail-mode-hook' (in that order)."
(make-local-variable 'mail-reply-action)
(error "Message contains non-ASCII characters"))))
;; Complain about any invalid line.
(goto-char (point-min))
- (while (< (point) (mail-header-end))
- (unless (looking-at "[ \t]\\|.*:\\|$")
- (push-mark opoint)
- (error "Invalid header line (maybe a continuation line lacks initial whitespace)"))
- (forward-line 1))
+ (re-search-forward (regexp-quote mail-header-separator) (point-max) t)
+ (let ((header-end (or (match-beginning 0) (point-max))))
+ (goto-char (point-min))
+ (while (< (point) header-end)
+ (unless (looking-at "[ \t]\\|.*:\\|$")
+ (push-mark opoint)
+ (error "Invalid header line (maybe a continuation line lacks initial whitespace)"))
+ (forward-line 1)))
(goto-char opoint)
(run-hooks 'mail-send-hook)
(message "Sending...")
nil)))
(defun mail-text ()
- "Move point to beginning of message text."
+ "Move point to beginning of text field."
(interactive)
(expand-abbrev)
(goto-char (mail-text-start)))