summaryrefslogtreecommitdiff
path: root/git-send-email.perl
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-06-06 00:06:44 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-06-06 00:06:44 -0700
commit9c41a17ca22015c70008245911fc7674b59c5e9d (patch)
treed6ee740ab7e0d3b4ec00480009c44293915ec2b3 /git-send-email.perl
parentMerge branch 'master' into next (diff)
parentsend-email: be more lenient and just catch obvious mistakes. (diff)
downloadtgif-9c41a17ca22015c70008245911fc7674b59c5e9d.tar.xz
Merge branch 'vb/sendemail' into next
* vb/sendemail: send-email: be more lenient and just catch obvious mistakes.
Diffstat (limited to 'git-send-email.perl')
-rwxr-xr-xgit-send-email.perl10
1 files changed, 6 insertions, 4 deletions
diff --git a/git-send-email.perl b/git-send-email.perl
index a7a7797778..700d0c3e15 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -312,16 +312,18 @@ our ($message_id, $cc, %mail, $subject, $reply_to, $references, $message);
sub extract_valid_address {
my $address = shift;
+ my $local_part_regexp = '[^<>"\s@]+';
+ my $domain_regexp = '[^.<>"\s@]+\.[^<>"\s@]+';
# check for a local address:
- return $address if ($address =~ /^([\w\-.]+)$/);
+ return $address if ($address =~ /^($local_part_regexp)$/);
if ($have_email_valid) {
- return Email::Valid->address($address);
+ return scalar Email::Valid->address($address);
} else {
# less robust/correct than the monster regexp in Email::Valid,
# but still does a 99% job, and one less dependency
- $address =~ /([\w\-.]+@[\w\-.]+)/;
+ $address =~ /($local_part_regexp\@$domain_regexp)/;
return $1;
}
}
@@ -384,7 +386,7 @@ X-Mailer: git-send-email $gitversion
defined $pid or die $!;
if (!$pid) {
exec($smtp_server,'-i',
- map { scalar extract_valid_address($_) }
+ map { extract_valid_address($_) }
@recipients) or die $!;
}
print $sm "$header\n$message";