haraka / node-address-rfc2822

Parser for RFC2822 (Header) format email addresses
https://www.npmjs.com/package/address-rfc2822
52 stars 16 forks source link

Text between square brackets generates a "No Results" error #59

Closed JeremyPouyet closed 11 months ago

JeremyPouyet commented 2 years ago

Some addresses I met contain text between brackets and this module generates an error. A simple example:

> const addrparser = require('address-rfc2822');
> const addresses = addrparser.parse("Matt Sergeant [hello] <helpme+npm@gmail.com>");
Uncaught Error: No results
    at Object.parse (/home/project/node_modules/address-rfc2822/index.js:32:22)

In section 3.2.1 of the RFC2822, these brackets are described with No special semantics are attached to these tokens. They are simply single characters. I don't know how the text between brackets should be handled but an error seems inappropriate.

msimerson commented 2 years ago

This library name wasn't future-proof, and as the README says, it is now compatible with RFC 5322. Our implementation is now based on email-addresses and there's an open issue there regarding brackets. The gist is, they're only allowed when the display name is quoted.