Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bracketing not supported #52

Open
Chrisjow opened this issue Sep 16, 2020 · 2 comments · May be fixed by #64
Open

Bracketing not supported #52

Chrisjow opened this issue Sep 16, 2020 · 2 comments · May be fixed by #64

Comments

@Chrisjow
Copy link

Hi,

I am using the 'email-addresses' package in order to parse incoming emails senders.
However, sometimes I get something like "JOHN DOE[XXX - DOE John] [email protected]". The functions parseOneAddress() and parseAddressList() both return null (image below).

Would be nice to accept this kind of format.

image

Thanks!

@jackbearheart
Copy link
Owner

Hi! To my understanding, the RFC rules don't allow this format as-is. (Getting technical, the fundamental reason is that the atext production in the spec doesn't include the [ or ] characters, so a non-quoted display name cannot include those. A quoted display name would, however.)

It would be valid if it were quoted, for example:

> addrs.parseAddressList('JOHN DOE <[email protected]>') !== null;
true
> addrs.parseAddressList('JOHN DOE[XXX] <[email protected]>') !== null;
false
> addrs.parseAddressList('"JOHN DOE[XXX]" <[email protected]>') !== null;
true

So from the perspective of this library, which was created to parse email addresses according to this specification, this is expected.

Now, that doesn't solve your problem. In curiosity, I wonder, what is your use case, what outside system is sending you emails in this format, and under what circumstances or as part of what protocol? That will help us figure out if there's anything this library can help with in a sane way. If there is a relevant spec or this is a common format then we could provide an option to allow it.

@Chrisjow
Copy link
Author

Chrisjow commented Oct 9, 2020

Hi, sorry for the delay.

I received an email with this format from a big corporate employee. So my use case is not really original. However, it's the only company that sends us this kind of format.

Hope it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants