From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#32639: 25.2; message-mode.el: invalid email address gives strange results Date: Mon, 13 May 2019 16:53:27 -0400 Message-ID: <87ftpiqdo8.fsf@mouse.gnus.org> References: <87sh2ok6jv.fsf@curie.anarc.at> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="131479"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 32639@debbugs.gnu.org To: Antoine Beaupre Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 13 22:58:07 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hQI1P-000Y5R-84 for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 May 2019 22:58:07 +0200 Original-Received: from localhost ([127.0.0.1]:34904 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQI1M-0005Dn-Bj for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 May 2019 16:58:04 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:45769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQI01-00049y-O0 for bug-gnu-emacs@gnu.org; Mon, 13 May 2019 16:56:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQHxS-0003CL-4t for bug-gnu-emacs@gnu.org; Mon, 13 May 2019 16:54:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:32940) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQHxS-0003CD-1f for bug-gnu-emacs@gnu.org; Mon, 13 May 2019 16:54:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQHxR-0000lp-VE for bug-gnu-emacs@gnu.org; Mon, 13 May 2019 16:54:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 May 2019 20:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32639 X-GNU-PR-Package: emacs Original-Received: via spool by 32639-submit@debbugs.gnu.org id=B32639.15577808162930 (code B ref 32639); Mon, 13 May 2019 20:54:01 +0000 Original-Received: (at 32639) by debbugs.gnu.org; 13 May 2019 20:53:36 +0000 Original-Received: from localhost ([127.0.0.1]:46484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQHx2-0000lB-2y for submit@debbugs.gnu.org; Mon, 13 May 2019 16:53:36 -0400 Original-Received: from quimby.gnus.org ([80.91.231.51]:46074) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQHx0-0000l4-Ai for 32639@debbugs.gnu.org; Mon, 13 May 2019 16:53:34 -0400 Original-Received: from [12.41.144.226] (helo=sandy) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1hQHww-0001Ym-2o; Mon, 13 May 2019 22:53:32 +0200 In-Reply-To: <87sh2ok6jv.fsf@curie.anarc.at> (Antoine Beaupre's message of "Tue, 04 Sep 2018 22:43:32 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:159218 Archived-At: Antoine Beaupre writes: > Emacs' message mode is not very indulgent on invalid email addresses and > especially typo which can occur in copy-paste. > > For example, I tried to send an email today to "foo " > only I screwed up when pasting so my "To:" header was actually: > > To: foo bar > ie. without a trailing bracket. Emacs happily accepts this (arguably) > invalid email address and expands that to "foo@$fqdn" and "bar > the right domain and the latter will fail because "bar valid user at "example.com". Yeah, Message should refuse to try to send email with invalid To/Cc addresses, I think. > I've probed a little into how this could be fixed, but somewhat got lost > between message.el's `message-fix-before-sending' and > `mail-extract-address-components'. Presumably there's some part in there > that could be improved, but I am not sure regular expressions are up to > standard to parse email addresses, as those are notoriously complicated. The standards-compliant function to use is: (mail-header-parse-addresses "foo bar nil (mail-header-parse-addresses "foo bar ") => (("quux@example.com" . "foo bar")) The problem is that this function doesn't really tell the user anything about what's wrong with the address -- it's either able to parse it or not. Another twist here is that if you have at least one valid address in the list, it won't tell you that there's anything wrong: (mail-header-parse-addresses "foo bar , zot>") => (("quux@example.com" . "foo bar")) But I guess we could add a parameter to ietf-drums-parse-addresses to make it return a more complete result. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no