]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/sendmail.el
Replace `iff' in doc-strings and comments.
[gnu-emacs] / lisp / mail / sendmail.el
index 5f99f9ffd98f3ad5cc9ab7c237b4bd7714a81ea3..5803661bc6e23a4cc4c0e1063c5fa0aba2dd17ff 100644 (file)
@@ -1,7 +1,7 @@
 ;;; 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
@@ -10,7 +10,7 @@
 
 ;; 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.
@@ -112,7 +122,6 @@ nil means let mailer mail back a message to report errors."
   :type 'boolean
   :group 'sendmail)
 
-;;;###autoload
 (defcustom mail-yank-ignored-headers
   (concat "^"
           (regexp-opt '("via" "mail-from" "origin" "status" "remailed"
@@ -124,6 +133,15 @@ nil means let mailer mail back a message to report errors."
   :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
@@ -597,18 +615,21 @@ actually occur.")
 (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)
@@ -852,11 +873,14 @@ the user from the mailer."
                (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...")
@@ -1368,7 +1392,7 @@ Create a Mail-Followup-To field if none."
       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)))