From: Rasmus Villemoes Date: Wed, 10 Oct 2018 13:29:56 GMT Subject: Re: [PATCH 2/3] send-email: only consider lines containing @ or <> for automatic Cc'ing Message-ID: <7b03da07-4301-1b42-b8a2-a29e4e1f80d0@rasmusvillemoes.dk> In-Reply-To: <871s8yez74.fsf@evledraar.gmail.com> On 2018-10-10 14:57, Ævar Arnfjörð Bjarmason wrote: > > On Wed, Oct 10 2018, Rasmus Villemoes wrote: > >> + if ($c !~ /.+@.+|<.+>/) { >> + printf("(body) Ignoring %s from line '%s'\n", >> + $what, $_) unless $quiet; >> + next; >> + } >> push @cc, $c; >> printf(__("(body) Adding cc: %s from line '%s'\n"), >> $c, $_) unless $quiet; > > There's a extract_valid_address() function in git-send-email already, > shouldn't this be: > > if (!extract_valid_address($c)) { > [...] > > Or is there a good reason not to use that function in this case? > I considered that (and also had a version where I simply insisted on a @ being present), but that means the user no longer would get prompted about the cases where the address was just slightly obfuscated, e.g. the Cc: John Doe cases, which would be a regression, I guess. So I do want to pass such cases through, and have them be dealt with when process_address_list gets called. So this is just a rather minimal and simple heuristic, which should still be able to handle the vast majority of cases correctly, and at least almost never exclude anything that might have a chance of becoming a real address. Rasmus