Skip to content

Feature request: detect malformed email addresses #2385

Open

Description

@jvns

I made a mistake in my cc: line, like this: cc: D. Ben Knoble" ben.knoble@gmail.com

and ended up with a bad CC address because of it "D. Ben Knoble <ben.knoble"@gmail.com>

Maybe this could be fixed, not clear how many people will run into this.

Activity

  1. webstech commented on Oct 10, 2026

    @webstech
    Contributor

    This is an edge case.

    Notes for myself and anyone else looking at this:
    gitgitgadget uses addressparser from nodemailer to do the email address generation from the cc: lines. It gets lost in the initial tokenization.

    The tokenizer result is:

    [
      { type: 'text', value: 'Mis Quote' },
      { type: 'operator', value: '"' },
      { type: 'text', value: '<mquote@gmail.com>' }
    ]
    

    whereas a properly quoted name is:

    [
      { type: 'operator', value: '"' },
      { type: 'text', value: 'Ms Quote' },
      { type: 'operator', value: '"' },
      { type: 'operator', value: '<' },
      { type: 'text', value: 'msquote@gmail.com' },
      { type: 'operator', value: '>' }
    ]
    

    and an unquoted value would not have the '"' operators.

    Not sure who has responsibility here. addressparser appears to expect valid (or mostly valid) email addresses. It does have some edge case handling but tries to work in spite of some bad input.

    In this case, a second misquoted address may produce valid addresses. eg both Cc: Mr Quote" <mrquote@gmail.com>, "Mrs Quote <mrsquote@gmail.com> and Cc: Mr Quote" <mrquote@gmail.com>, Mrs Quote" <mrsquote@gmail.com> may produce valid output (ready to be reparsed). Just bringing this up to note an even number of '"' is not a reliable test. Having said that, an odd number check for '"' may be the simplest check. Reviewing if operator state checking can be added to addressparser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions