Git Product home page Git Product logo

email-forward-parser's People

Contributors

baptistejamin avatar eliottvincent avatar gwatts avatar sc0ttes avatar valeriansaliou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

email-forward-parser's Issues

Outsource regexes?

In regard to #10 I think it would be very beneficial if the regexes would be outsourced to a single repo focused only on them. This would allow developers to use and update them more easily (which will also help you! :D).

To integrate them into other apps one may download them for example on a nightly basis via ci:cd and include them into their package.

What do you think? I'd be very happy about it! :)

Add types for the library

Hi! This is great, I was starting to write a very crude version and found this great library. Is it possible to add type declarations for TypeScript, and/or would you accept such a contribution to the codebase?

Multiple re2 installations, should be a peer dependency

Hello

We found an error because we are using this library, and url-regex-safe at the same time, and both link to node-re2 library.

So when we run jest, we find a malloc issue. See this repo we created https://github.com/blastradius-ai/re2-malloc-error.

The solution would be to put re2 as a peer-dependency, like url-regex-safe has done it in its latest version (https://github.com/spamscanner/url-regex-safe/releases/tag/v3.0.0).

So that way we would have to install re2 ourselves, and only a single instance is created.

Hope this can be done, or if you want we can create a PR for that.

Thanks

error while importing package

I'm trying to use this package but my builds fail with the following error:

ERROR in ../../email-forward-parser/node_modules/re2/re2.js 3:12-42
Module not found: Error: Can't resolve './build/Release/re2' in './node_modules/email-forward-parser/node_modules/re2'
 @ ../../email-forward-parser/lib/parser.js 4:34-48
 @ ../../email-forward-parser/lib/index.js 4:13-32

webpack compiled with 1 error
Environment: darwin, node 14.19.1,

Python version?

Hey this is more kind of a question than an issue. Is this package available as a python package? I'd be very keen to see one as I'm currently developing an email alias service that runs on Python :D

Would it be possible to get the layered forwarded emails?

This is more a feasibility question.

If I have this email:

E2
  E1
    E0

Currently we get E0 information. This is good.

Would it be feasible to get E2 and E1 separately? Like in

const allFw = new EmailForwardParser().readAll(emailBodyAsText, emailSubject);

allFw[0] == E0
allFw[1] == E1
allFw[2] == E2

(backwards would also be ok)

I know the lib can't today, but the question would it be sound and feasible?

Thanks!

Cannot find module './build/Release/re2.node'

Good day to everyone!
I ran this in js file with node file-ex.js

const EmailForwardParser = require("./email-forward-parser");
const result = new EmailForwardParser().read(MY_EMAIL_STRING, MY_SUBJECT_STRING);
console.log(result);

And got the error below:

Error: Cannot find module './build/Release/re2.node'
Require stack:

  • C:\Users\dmitry\Desktop\email-forward-parser\node_modules\re2\re2.js
  • C:\Users\dmitry\Desktop\email-forward-parser\lib\parser.js
  • C:\Users\dmitry\Desktop\email-forward-parser\lib\index.js
  • C:\Users\dmitry\Desktop\file-ex.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15)
    at Function.Module._load (internal/modules/cjs/loader.js:774:27)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object. (C:\Users\dmitry\Desktop\email-forward-parser\node_modules\re2\re2.js:3:13)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
    'C:\Users\dmitry\Desktop\email-forward-parser\node_modules\re2\re2.js',
    'C:\Users\dmitry\Desktop\email-forward-parser\lib\parser.js',
    'C:\Users\dmitry\Desktop\email-forward-parser\lib\index.js',
    'C:\Users\dmitry\Desktop\file-ex.js'
    ]
    }

GMail Plain Text Wrapping

Thanks for providing this library, it's excellent.

I wonder if you've ever seen an issue we're seeing where when we pass the plain-text email text to the library which has come from gmail, the lines are wrapped at 78 characters. This means that the cc list doesn't get parsed correctly and we end up with incomplete recipient lists. An example of how those emails look is shown below.

---------- Forwarded message ---------
From: Sender <[email protected]>
Date: Fri, 25 Feb 2022 at 18:08
Subject: Test Email
To: Recipient <[email protected]>
Cc: Recipient 1 <[email protected]>, Recipient 2 <
[email protected]>, Recipient 3 <[email protected]>


Email Start Here...

Failed to parse non-indented forwarded emails

We've recently seen many forwarded emails that did not have any indentation (not sure the vendor/client application that does this).

But the fact is that the email cannot be parsed and we cannot extract the contents.

image

Any recommendation for this? Do you consider this is a bug?

Mails with blocks added after underscore are not correctly managed

Hi,

Your lib is great! Thank you!

Nevertheless I have an issue when I parse a forwarded message containing an automatically insterted block that is inserted in the end following multiple "_".

A reproducer:

I transfer you that mail.

De : Jorge BARANGUAN <[email protected]>
Envoyé : jeudi 6 avril 2023 16:17
À : Jorge BARANGUAN <[email protected]>
Objet : ***URGENT** 9673155358 nos réf


MY body email...
  ________________________________
  This email (including any attachments) is intended for the designated recipient(s) only, and may be confidential, non-public, proprietary, and/or protected by the attorney-client or other privilege. Unauthorized reading, distribution, copying or other use of this communication is prohibited and may be unlawful. Receipt by anyone other than the intended recipient(s) should not be deemed a waiver of any privilege or protection. If you are not the intended recipient or if you believe that you have received this email in error, please notify the sender immediately and delete all copies from your computer system without reading, saving, printing, forwarding or using it in any manner. Although it has been checked for viruses and other malicious software (\"malware\"), we do not warrant, represent or guarantee in any way that this communication is free of malware or potentially damaging defects. All liability for any actual or alleged loss, damage, or injury arising out of or resulting in any way from the receipt, opening or use of this email is expressly disclaimed.

When performing new EmailForwardParser().read(mailBody, "***URGENT** 9673155358 nos réf"), the lib detects the part after the ____ (This email (including any attachments) is intended for the designated recipient(s) only...) as the forwarded email, hence I cannot extract the from/to information.

Do you think that it could be fixed by removing this groups of _ characters before parsing?

Running this package with node18 in aws lambda results in GCLIB errors

I'm getting the error below when attempting to run node18 with this package installed.

ERROR	0 Error: /lib64/libc.so.6: version `GLIBC_2.34' not found (required by /var/task/node_modules/email-forward-parser/node_modules/re2/build/Release/re2.node)
    at Module._extensions..node (node:internal/modules/cjs/loader:1243:18)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/var/task/node_modules/email-forward-parser/node_modules/re2/re2.js:3:13)
    at Module._compile (node:internal/modules/cjs/loader:1159:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12) {
  code: 'ERR_DLOPEN_FAILED'
}

I think this could be remedied by updating the re2 library to the latest version, so that it supports new targets.

Specifically, the 1.16.0 version does not seem to have targets for node18, while the 1.18.0 latest build does.

Would it be possible to add this update? Would you prefer I make a PR for this?

Outlook Desktop does not parse the forwarded email

Hi

We have this email that comes forwarded from Outlook Desktop, and the library does not parse it.

This is the email (one peculiarity is the body is sent in base64) as smtp.

--_000_MWHPR12MB18567616136F0AE4AF3AF9BFCF529MWHPR12MB1856namp_
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64

CgpGcm9tOiBKb2UgTW9udGFuYSA8am9lbW9udGFuYUBlbWFpbC5jb20+ClNlbnQ6IFR1ZXNkYXksIEphbnVhcnkgMTEsIDIwMjIgMzozNCBQTQpUbzogTWFyeSBNb250YW5hIDxtYXJ5bW9udGFuYUBlbWFpbC5jb20+ClN1YmplY3Q6IFByZXNzaW5nIG1hdHRlcgoKSGkKCkJ5ZQo=

Decoded is:



From: Joe Montana <[email protected]>
Sent: Tuesday, January 11, 2022 3:34 PM
To: Mary Montana <[email protected]>
Subject: Pressing matter

Hi

Bye

NOTE: I had to fake the email and the base64, so in theory it does work.

After some tests and playing around with the text, I was able to workaround this by adding a __ separator at the beginning, kind of tricking the library so it can parse it.

This would be how it would work, but obviously we want to try to avoid this minor hacks.

____________________________


From: Joe Montana <[email protected]>
Sent: Tuesday, January 11, 2022 3:34 PM
To: Mary Montana <[email protected]>
Subject: Pressing matter

Hi

Bye

Can a fix be possible (so we don't have to add the workaround)?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.