# HG changeset patch # User Richard M. Stallman # Date 871596630 0 # Node ID d7ecbd12ecefcf1f362080e59498ec20a908bcbb # Parent 7f45f7ed50c8afc83b24032b20473ff368bf18a4 (mail-send): Ask for confirmation if message contains non-ASCII characters. (mail-send-nonascii): New variable. diff -r 7f45f7ed50c8 -r d7ecbd12ecef lisp/mail/sendmail.el --- 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)