changeset 19350:d7ecbd12ecef

(mail-send): Ask for confirmation if message contains non-ASCII characters. (mail-send-nonascii): New variable.
author Richard M. Stallman <rms@gnu.org>
date Thu, 14 Aug 1997 22:10:30 +0000
parents 7f45f7ed50c8
children cf429b6a3ab8
files lisp/mail/sendmail.el
diffstat 1 files changed, 19 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/sendmail.el	Thu Aug 14 22:10:02 1997 +0000
+++ b/lisp/mail/sendmail.el	Thu Aug 14 22:10:30 1997 +0000
@@ -178,6 +178,13 @@
 the RMAIL summary buffer before returning, if it exists and this variable
 is non-nil.")
 
+(defvar mail-send-nonascii 'query
+  "*Specify whether to allow sending non-ASCII characters in mail.
+If t, that means do allow it.  nil means don't allow it.
+`query' means ask the user each time.
+Including non-ASCII characters in a mail message can be problematical
+for the recipient, who may not know how to decode them properly.")
+
 ;; Note: could use /usr/ucb/mail instead of sendmail;
 ;; options -t, and -v if not interactive.
 (defvar mail-mailer-swallows-blank-line
@@ -555,7 +562,18 @@
 	  (y-or-n-p "Send buffer contents as mail message? ")
 	(or (buffer-modified-p)
 	    (y-or-n-p "Message already sent; resend? ")))
-      (let ((inhibit-read-only t))
+      (let ((inhibit-read-only t)
+	    (opoint (point)))
+	(when (and enable-multibyte-characters
+		   (not (eq mail-send-nonascii t)))
+	  (goto-char (point-min))
+	  (skip-chars-forward "\0-\177")
+	  (or (= (point) (point-max))
+	      (if (eq mail-send-nonascii 'query)
+		  (or (y-or-n-p "Message contains non-ASCII characters; send anyway? ")
+		      (error "Aborted"))
+		(error "Message contains non-ASCII characters"))))
+	(goto-char opoint)
 	(run-hooks 'mail-send-hook)
 	(message "Sending...")
 	(funcall send-mail-function)