]> git.eshelyaron.com Git - emacs.git/commitdiff
Make Message warn about invalid addresses
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 22 Sep 2019 23:06:15 +0000 (01:06 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 22 Sep 2019 23:06:15 +0000 (01:06 +0200)
* lisp/gnus/message.el (message-check-recipients): Warn about
invalid email addresses (bug#32639).

lisp/gnus/message.el

index ef9f8429d40815a3ee94b9e3d9af0f3b1bb6e930..4ea8f7b02e6d5bdffa53009937e2849feee114b3 100644 (file)
@@ -4364,6 +4364,14 @@ This function could be useful in `message-setup-hook'."
     (dolist (hdr '("To" "Cc" "Bcc"))
       (let ((addr (message-fetch-field hdr)))
        (when (stringp addr)
+         ;; First check for syntactically invalid addresses.
+         (dolist (address (mail-header-parse-addresses addr t))
+           (unless (mail-header-parse-addresses address)
+             (unless (y-or-n-p
+                      (format "Email address %s looks invalid; send anyway?"
+                              address))
+               (user-error "Invalid address %s" address))))
+         ;; Then check for likely-bogus addresses.
          (dolist (bog (message-bogus-recipient-p addr))
            (and bog
                 (not (y-or-n-p