git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] send-email: quiet some warnings, reject invalid addresses

From
EWEric Wong <normalperson@yhbt.net>
Date
May 15, 2006, 09:41 UTC
Message-ID
<11476860611181-git-send-email-normalperson@yhbt.net>
In-Reply-To
<7vlkt3x1qz.fsf@assigned-by-dhcp.cox.net>

I'm not sure why we never actually rejected invalid addresses in the first place. We just seemed to be using our email validity checkers to kill duplicates.

Now we just drop invalid email addresses completely and warn the user about it.

Since we support local sendmail, we'll also accept username-only addresses.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
---
 git-send-email.perl |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
f069e9a9cee726d82dfeee1d477152a0fe0651c1
diff --git a/git-send-email.perl b/git-send-email.perl
index 0540e93..312a4ea 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -307,6 +307,10 @@ our ($message_id, $cc, %mail, $subject, 
 
 sub extract_valid_address {
 	my $address = shift;
+
+	# check for a local address:
+	return $address if ($address =~ /^([\w\-]+)$/);
+
 	if ($have_email_valid) {
 		return Email::Valid->address($address);
 	} else {
@@ -498,9 +502,14 @@ sub unique_email_list(@) {
 	my @emails;
 
 	foreach my $entry (@_) {
-		my $clean = extract_valid_address($entry);
-		next if $seen{$clean}++;
-		push @emails, $entry;
+		if (my $clean = extract_valid_address($entry)) {
+			$seen{$clean} ||= 0;
+			next if $seen{$clean}++;
+			push @emails, $entry;
+		} else {
+			print STDERR "W: unable to extract a valid address",
+					" from: $entry\n";
+		}
 	}
 	return @emails;
 }
-- 
1.3.2.g7d11
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 17 in “send-email: allow sendmail binary to be used instead of SMTP”
  1. send-email: allow sendmail binary to be used instead of SMTPEric Wong, May 15, 2006
  2. Eric WongMay 15, 2006
  3. send-email: quiet some warningsEric Wong, May 15, 2006
  4. Junio C HamanoMay 15, 2006
  5. send-email: quiet some warnings, reject invalid addressesEric Wong, May 15, 2006
  6. Junio C HamanoMay 15, 2006
  7. Eric WongMay 15, 2006
  8. send-email: allow sendmail binary to be used instead of SMTPEric Wong, May 15, 2006
  9. Junio C HamanoMay 15, 2006
  10. Eric WongMay 15, 2006
  11. Martin LanghoffMay 15, 2006
  12. Junio C HamanoMay 15, 2006
  13. Eric WongMay 15, 2006
  14. Ryan AndersonMay 15, 2006
  15. Junio C HamanoMay 15, 2006
  16. Ryan AndersonMay 15, 2006
  17. Martin LanghoffMay 15, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.