]> git.eshelyaron.com Git - emacs.git/commitdiff
Make Message check for invalid recipients before sending
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 19 Jan 2022 18:00:13 +0000 (19:00 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 19 Jan 2022 18:00:13 +0000 (19:00 +0100)
* lisp/gnus/message.el (message-check-recipients): Check for
suspicious addresses before sending (bug#51733).

lisp/gnus/message.el

index 8f11e538c5a1ec7d24c7d006bbfe6cc62a460654..1f47e696c305f5c9c7bc94c46b5c7e912dc8e40d 100644 (file)
@@ -4663,6 +4663,12 @@ This function could be useful in `message-setup-hook'."
                       (format "Email address %s looks invalid; send anyway?"
                               address))
                (user-error "Invalid address %s" address))))
+         ;; Then check for suspicious addresses.
+         (dolist (address (mail-header-parse-addresses addr t))
+           (when-let ((warning (textsec-check address 'email-address-header)))
+             (unless (y-or-n-p
+                      (format "Suspicious address: %s; send anyway?" warning))
+               (user-error "Suspicious address %s" address))))
          ;; Then check for likely-bogus addresses.
          (dolist (bog (message-bogus-recipient-p addr))
            (and bog