(substring s (match-beginning 3) (match-end 3)) " "
+(defun mail-y-or-n-p (question &rest text)
+ "Ask QUESTION, displaying the rest of the arguments as strings in a buffer."
+ (setq text (mail-flatten-list text))
+ (with-output-to-temp-buffer " *SMTP information message*"
+ (set-buffer " *SMTP information message*")
+ (fundamental-mode) ; for Emacs 20.4+
+ (goto-char (point-min))))
+(defun mail-flatten-list (list)
+ "Return a new, flat list that contains all elements of LIST.
+\(mail-flatten-list '(1 (2 3 (4 5 (6))) 7))
+ (apply 'append (mapcar 'mail-flatten-list list)))
+(defun mail-check-safe-charset ()
+ "Check that buffer contain characters that will be safely encoded."
+ (let ((bad-charsets (set-difference
+ (find-charset-region (point-min) (point-max))
+ '(ascii latin-iso8859-1 control-1))))
+ "Your message contain invalid characters. Continue? "
+ "You're trying to send a message that contain characters\nin the following character set:\n\n" (mapconcat 'symbol-name bad-charsets ", ") "\n\nThese characters cannot be send without proper encoding. Please\nconsider using a MIME enabled mail composer (such as `message').\nContinuing is likely to cause mail corruption.")
+ (error "Message contain invalid character"))))))
;;; mail-utils.el ends here