Re: [BUG] git send-email: incorrectly parses email address with comma
- From
Jeff King <peff@peff.net>
- Date
- May 12, 2018, 09:48 UTC
- Message-ID
- <20180512094849.GI28279@sigill.intra.peff.net>
- In-Reply-To
- <9a35041b-8333-9533-4344-08d6ef99c9c9@gmx.de>
On Sat, May 12, 2018 at 10:21:46AM +0200, Heinrich Schuchardt wrote:
Show 10 quoted lines
> Git send-email allows to combine multiple email addresses in one > parameter, e.g. > > --to="a@example.com, b@example.com" > > But email addresses may contain commas themselves: > > --to="LASTNAME, firstname <firstname.lastname@example.com>" > > This may lead to an error:
If the name contains syntactically relevant metacharacters, it can be quoted. So as a workaround, you can do:
--to='"LASTNAME, firstname" <firstname.lastname@example.com>'
I think rfc822 actually requires even names with just spaces in them to be quoted, but git-send-email and most other mail programs are pretty lax about allowing just about anything outside of the <>, so people tend not to bother.
> If the string preceding a comma is not a valid email address do not > split it off.
That might work as a heuristic, though "is a valid email address" is a notoriously hard thing to check. Possibly looking for an "@" would catch most common cases, though.
-Peff