summaryrefslogtreecommitdiff
path: root/lisp/mail/sendmail.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-12-16 08:06:37 +0000
committerRichard M. Stallman <rms@gnu.org>1996-12-16 08:06:37 +0000
commit953c25c886040a1e3b81030320397fbaa644e026 (patch)
tree373760946a1729e365980b1183ccfb6da1b2dbbb /lisp/mail/sendmail.el
parent1612874457f7c946f6af1fe12bf31f6e581bf80d (diff)
downloademacs-953c25c886040a1e3b81030320397fbaa644e026.tar.gz
(sendmail-send-it): If no recipients, don't run
the mailer program. If there was also no fcc file, signal error.
Diffstat (limited to 'lisp/mail/sendmail.el')
-rw-r--r--lisp/mail/sendmail.el62
1 files changed, 36 insertions, 26 deletions
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 27273995bd6..9ad63d69737 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -559,6 +559,7 @@ the user from the mailer."
(case-fold-search nil)
resend-to-addresses
delimline
+ fcc-was-found
(mailbuf (current-buffer)))
(unwind-protect
(save-excursion
@@ -677,36 +678,45 @@ the user from the mailer."
;; Find and handle any FCC fields.
(goto-char (point-min))
(if (re-search-forward "^FCC:" delimline t)
- (mail-do-fcc delimline))
+ (progn
+ (setq fcc-was-found t)
+ (mail-do-fcc delimline)))
(if mail-interactive
(save-excursion
(set-buffer errbuf)
(erase-buffer))))
- (let ((default-directory "/"))
- (apply 'call-process-region
- (append (list (point-min) (point-max)
- (if (boundp 'sendmail-program)
- sendmail-program
- "/usr/lib/sendmail")
- nil errbuf nil "-oi")
- ;; Always specify who from,
- ;; since some systems have broken sendmails.
- (list "-f" (user-login-name))
-;;; ;; Don't say "from root" if running under su.
-;;; (and (equal (user-real-login-name) "root")
-;;; (list "-f" (user-login-name)))
- (and mail-alias-file
- (list (concat "-oA" mail-alias-file)))
- ;; These mean "report errors by mail"
- ;; and "deliver in background".
- (if (null mail-interactive) '("-oem" "-odb"))
- ;; Get the addresses from the message
- ;; unless this is a resend.
- ;; We must not do that for a resend
- ;; because we would find the original addresses.
- ;; For a resend, include the specific addresses.
- (or resend-to-addresses
- '("-t")))))
+ (goto-char (point-min))
+ (if (let ((case-fold-search t))
+ (re-search-forward "^To:\\|^cc:\\|^bcc:\\|^resent-to:\
+\\|^resent-cc:\\|^resent-bcc:"
+ delimline t)
+ (let ((default-directory "/"))
+ (apply 'call-process-region
+ (append (list (point-min) (point-max)
+ (if (boundp 'sendmail-program)
+ sendmail-program
+ "/usr/lib/sendmail")
+ nil errbuf nil "-oi")
+ ;; Always specify who from,
+ ;; since some systems have broken sendmails.
+ (list "-f" (user-login-name))
+ ;;; ;; Don't say "from root" if running under su.
+ ;;; (and (equal (user-real-login-name) "root")
+ ;;; (list "-f" (user-login-name)))
+ (and mail-alias-file
+ (list (concat "-oA" mail-alias-file)))
+ ;; These mean "report errors by mail"
+ ;; and "deliver in background".
+ (if (null mail-interactive) '("-oem" "-odb"))
+ ;; Get the addresses from the message
+ ;; unless this is a resend.
+ ;; We must not do that for a resend
+ ;; because we would find the original addresses.
+ ;; For a resend, include the specific addresses.
+ (or resend-to-addresses
+ '("-t")))))
+ (or fcc-was-found
+ (error "No recipients")))
(if mail-interactive
(save-excursion
(set-buffer errbuf)