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

erroneous parsing of from field #23

Open
SebiTimeWaster opened this issue Jun 23, 2019 · 2 comments
Open

erroneous parsing of from field #23

SebiTimeWaster opened this issue Jun 23, 2019 · 2 comments
Labels

Comments

@SebiTimeWaster
Copy link

raw email:
From: "Almaifd, Tim" <[email protected]>

return:

from:
   [ { address: '"Almaifd', name: null },
     { address: '[email protected]', name: ' Tim"' } ],

should be:

from: { address: '[email protected]', name: 'Almaifd, Tim' },
@brettz9
Copy link
Contributor

brettz9 commented Mar 3, 2020

I see the spec defines this field at https://tools.ietf.org/html/rfc5322#section-3.6.2 with the mailbox-list rule and its derivatives at https://tools.ietf.org/html/rfc5322#section-3.4 . Unless you were planning on hand-coding a parser for this, might you wish to use pegjs? It can be fairly easily to just define the grammar and get a parser built for it.

@jhermsmeier
Copy link
Owner

I should note that this module was never really intended to be strictly standards-compliant (for that, it's probably better to use https://github.com/ronomon/mime, for example) – I just built it to process large batches of emails (that have been through validating systems previously) fairly quickly.

I am open to the idea to turn Envelope into a standards-compliant MIME message decoder / encoder though, and I guess the people using this module wouldn't mind that either :)

Unless you were planning on hand-coding a parser for this, might you wish to use pegjs? It can be fairly easily to just define the grammar and get a parser built for it.

I would indeed hand-roll parsers for these things, parser-generators (like pegjs) are too much cruft & overhead in these cases.

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

No branches or pull requests

3 participants